From 3deb377aae0716f72e738734b36c667be51f9172 Mon Sep 17 00:00:00 2001 From: JRGTH Date: Thu, 23 Oct 2025 15:46:41 -0400 Subject: [PATCH] Allow install in zroot platform with optional zfs dataset Allow extension installations in zroot platform with optional zfs user dataset --- CHANGELOG | 1 + bastille-init | 13 ++++++++++++- unionfs.sh | 1 + version | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c0f95b0..f6e3202 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ ====================== Version Description +1.2.20......Allow install in zroot platform with optional zfs dataset. 1.2.19......Fix typo in tarballs page and cleanup, thanks to Lux. 1.2.18......Fix typo in tarballs download page, thanks to Lux. 1.2.17......Check if bastille_zfs_enable is actually set to NO before zfs disable. diff --git a/bastille-init b/bastille-init index 857fea8..de7d007 100755 --- a/bastille-init +++ b/bastille-init @@ -116,6 +116,17 @@ if [ "${bastille_zfs_enable}" = "YES" ] || [ "${bastille_zfs_enable}" = "yes" ]; 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 + # Check if is a zroot install with optional zfs dataset. + if [ -z "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM}" ]; then + ZROOT=$(mount | awk -F '/' '/ \/ / {print $1}') + if echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT}" | grep -q "/${ZROOT}"; then + BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM="/${ZROOT}" + CWDIR_TRIM=$(echo "${CWDIR}" | sed "s|/mnt/||;s|/${DAFAULT_BASTILLE_PREFIX}||") + if zfs get -H -o value mountpoint "${ZROOT}/${CWDIR_TRIM}"; then + CWDIR_TRIM="/${ZROOT}" + fi + fi + fi BASTILLE_ZFS_PREFIX_TRIM=$(echo "${bastille_zfs_prefix}" | sed "s|/${DAFAULT_BASTILLE_PREFIX}||") fi # Check bastille ZFS config match on disk ZFS config. @@ -1532,7 +1543,6 @@ linux_compat_enable() # Manually enable Linux compatibility(Experimental). if ! sysrc -f ${CWDIR}${EXTCONF} -qc LINUX_COMPAT_SUPPORT=YES; then echo "Enabling Linux compatibility support..." - #${CWDIR}/unionfs.sh fetch_pkg && ${CWDIR}/unionfs.sh load_kmods && ${CWDIR}/unionfs.sh unionfs_on && sysrc -f ${CWDIR}${EXTCONF} LINUX_COMPAT_SUPPORT="YES" >/dev/null 2>&1 ${CWDIR}/unionfs.sh fetch_debootstrap && ${CWDIR}/unionfs.sh load_kmods && sysrc -f ${CWDIR}${EXTCONF} LINUX_COMPAT_SUPPORT="YES" >/dev/null 2>&1 else echo "Linux compatibility already enabled." @@ -1569,6 +1579,7 @@ bootstrap_dist() fi # Enable debootstrap environment. + trap "${CWDIR}/unionfs.sh unionfs_off" 0 1 2 5 15 ${CWDIR}/unionfs.sh unionfs_on # Bootstrap Linux flavor using bastille. diff --git a/unionfs.sh b/unionfs.sh index 165c484..8f2d89e 100755 --- a/unionfs.sh +++ b/unionfs.sh @@ -149,6 +149,7 @@ fetch_pkg() { mkdir -p ${CWDIR}/system/var/db/pkg fi + trap "unionfs_pkgoff" 0 1 2 5 15 unionfs_pkgon echo "Fetching required packages." diff --git a/version b/version index 9ddbe16..53fc08d 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.2.19 +1.2.20