Add patch to improve ZFS activation, contributed by disaster

This commit is contained in:
JRGTH
2021-12-19 20:02:24 -04:00
parent c1bb8d0cfc
commit 046b5ca191
3 changed files with 19 additions and 6 deletions
+1
View File
@@ -3,6 +3,7 @@
====================== ======================
Version Description Version Description
1.1.03......Add patch to improve ZFS activation, contributed by disaster.
1.1.02......Create required dir for templates link creation. 1.1.02......Create required dir for templates link creation.
1.1.01......Cosmetic changes, update maintenance page. 1.1.01......Cosmetic changes, update maintenance page.
1.1.00......Initial support for Linux jails(experimental). 1.1.00......Initial support for Linux jails(experimental).
+17 -5
View File
@@ -44,6 +44,8 @@ CWDIR=$(dirname $(realpath $0))
# Global variables. # Global variables.
CWDIR_TRIM="" CWDIR_TRIM=""
BASTILLE_ZFS_ZPOOL_MOUNTPOINT=""
BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM=""
REQUIRED_UPDATE="" REQUIRED_UPDATE=""
PLATFORM=$(uname -m) PLATFORM=$(uname -m)
PRODUCT=$(uname -i) PRODUCT=$(uname -i)
@@ -86,9 +88,19 @@ OPT="${1}"
# Bastille required # Bastille required
if [ -f "${BASTILLECONF}" ]; then if [ -f "${BASTILLECONF}" ]; then
. /${BASTILLECONF} . /${BASTILLECONF}
# Always enforce ZFS activation below "/mnt/" from the extension. if [ "${bastille_zfs_enable}" = "YES" -o "${bastille_zfs_enable}" = "yes" ]; then
if echo "${CWDIR}" | grep -q '/mnt/'; then if [ -n "${bastille_zfs_prefix}" ] && [ -n "${bastille_zfs_zpool}" ]; then
CWDIR_TRIM=$(echo "${CWDIR}" | sed "s|/mnt/||;s|/${bastille_zfs_prefix}||") # Always enforce ZFS activation below "/mnt/" from the extension.
if echo "${CWDIR}" | grep -q '/mnt/'; then
CWDIR_TRIM=$(echo "${CWDIR}" | sed "s|/mnt/||;s|/${bastille_zfs_prefix}||")
fi
BASTILLE_ZFS_ZPOOL_MOUNTPOINT=$(zfs get -H -o value mountpoint "${bastille_zfs_zpool}")
BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM=""
if echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT}" | grep -q '/mnt/'; then
BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM=$(echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT}" | sed "s|/mnt/||;s|/${bastille_zfs_prefix}||")
fi
fi
fi fi
fi fi
@@ -828,7 +840,7 @@ zfs_activate()
{ {
# Check if ZFS is already configured. # Check if ZFS is already configured.
# Always enforce ZFS activation below "/mnt/" from the extension. # Always enforce ZFS activation below "/mnt/" from the extension.
if echo "${bastille_zfs_zpool}" | grep -qw "${CWDIR_TRIM}$"; then if echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM}" | grep -qw "${CWDIR_TRIM}$"; then
BASTILLE_DIR=$(echo "${CWDIR}" | grep -o '[^/]*$') BASTILLE_DIR=$(echo "${CWDIR}" | grep -o '[^/]*$')
if [ "${bastille_zfs_prefix}" != "${BASTILLE_DIR}" ]; then if [ "${bastille_zfs_prefix}" != "${BASTILLE_DIR}" ]; then
@@ -1114,7 +1126,7 @@ rc_params()
if zfs list "${bastille_zfs_zpool}/${BASTILLE_DIR}" > /dev/null 2>&1; then if zfs list "${bastille_zfs_zpool}/${BASTILLE_DIR}" > /dev/null 2>&1; then
sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="YES" >/dev/null 2>&1 sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="YES" >/dev/null 2>&1
else else
if echo "${bastille_zfs_zpool}" | grep -qw "${CWDIR_TRIM}$"; then if echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM}" | grep -qw "${CWDIR_TRIM}$"; then
sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="AVA" >/dev/null 2>&1 sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="AVA" >/dev/null 2>&1
else else
sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="ERR" >/dev/null 2>&1 sysrc -f ${CWDIR}${EXTCONF} ZFS_SUPPORT="ERR" >/dev/null 2>&1
+1 -1
View File
@@ -1 +1 @@
1.1.02 1.1.03