From fb036a29da3a5f59822899c605c4ea666254992b Mon Sep 17 00:00:00 2001 From: JRGTH Date: Sun, 5 Oct 2025 01:06:40 -0400 Subject: [PATCH] Fallback for custom bastille prefix name Fallback for custom bastille prefix name, for example capitalized "Bastille" prefix. --- CHANGELOG | 1 + bastille-init | 19 ++++++++++++------- unionfs.sh | 0 version | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) mode change 100644 => 100755 bastille-init mode change 100644 => 100755 unionfs.sh diff --git a/CHANGELOG b/CHANGELOG index 348f421..8868d3f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ ====================== Version Description +1.2.13... ..Fallback for custom bastille prefix name. 1.2.12......Minor code improvements, clean stale pkg files on error. 1.2.11......Add all bastille Linux flavors bootstrap options. 1.2.10......Minor code improvements and cleanup. diff --git a/bastille-init b/bastille-init old mode 100644 new mode 100755 index 369b004..0fca6a7 --- a/bastille-init +++ b/bastille-init @@ -103,6 +103,11 @@ BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM= # Get extension ZFS config info. if [ "${bastille_zfs_enable}" = "YES" ] || [ "${bastille_zfs_enable}" = "yes" ]; then if [ -n "${bastille_zfs_prefix}" ] && [ -n "${bastille_zfs_zpool}" ]; then + DAFAULT_BASTILLE_PREFIX="${APPNAME}" + if [ "${CWDIR##*/}" != "${APPNAME}" ]; then + # Assume custom bastille prefix. + DAFAULT_BASTILLE_PREFIX="${CWDIR##*/}" + fi # 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}||") @@ -111,7 +116,7 @@ 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 - BASTILLE_ZFS_PREFIX_TRIM=$(echo "${bastille_zfs_prefix}" | sed "s|/${APPNAME}||") + BASTILLE_ZFS_PREFIX_TRIM=$(echo "${bastille_zfs_prefix}" | sed "s|/${DAFAULT_BASTILLE_PREFIX}||") fi # Check bastille ZFS config match on disk ZFS config. BASTILLE_CONFIG_DISK=$(zfs list -H "${bastille_prefix}" 2>/dev/null | awk '{print $1}') @@ -1341,7 +1346,7 @@ rc_params() fi # Check and make sure bastille_zfs_prefix end with "bastille". - if ! echo "${bastille_zfs_prefix}" | grep -qw "${APPNAME}"; then + if ! echo "${bastille_zfs_prefix}" | grep -qw "${DAFAULT_BASTILLE_PREFIX}"; then zfs_support_error exit 1 fi @@ -1355,20 +1360,20 @@ rc_params() fi # Perform some checks against on-disk and file configurations. - if zfs list "${bastille_zfs_zpool}/${BASTILLE_ZFS_PREFIX_TRIM}/${APPNAME}" >/dev/null 2>&1; then + if zfs list "${bastille_zfs_zpool}/${BASTILLE_ZFS_PREFIX_TRIM}/${DAFAULT_BASTILLE_PREFIX}" >/dev/null 2>&1; then # Looks like ZFS support is already configured, then set parameters. zfs_support_enabled elif zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1 && \ - [ "${bastille_zfs_prefix}" = "${BASTILLE_ZFS_PREFIX_TRIM}/${APPNAME}" ]; then + [ "${bastille_zfs_prefix}" = "${BASTILLE_ZFS_PREFIX_TRIM}/${DAFAULT_BASTILLE_PREFIX}" ]; then # Looks like ZFS support is available for activation. zfs_support_avail - elif zfs list "${bastille_zfs_zpool}/${APPNAME}" >/dev/null 2>&1; then + elif zfs list "${bastille_zfs_zpool}/${DAFAULT_BASTILLE_PREFIX}" >/dev/null 2>&1; then zfs_support_enabled elif zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1 && \ - [ "${BASTILLE_ZFS_PREFIX_TRIM}" = "${APPNAME}" ]; then + [ "${BASTILLE_ZFS_PREFIX_TRIM}" = "${DAFAULT_BASTILLE_PREFIX}" ]; then # Looks like ZFS support is available for activation. zfs_support_avail - elif zfs list "${bastille_zfs_zpool}/${APPNAME}" >/dev/null 2>&1; then + elif zfs list "${bastille_zfs_zpool}/${DAFAULT_BASTILLE_PREFIX}" >/dev/null 2>&1; then zfs_support_enabled else zfs_support_error diff --git a/unionfs.sh b/unionfs.sh old mode 100644 new mode 100755 diff --git a/version b/version index f2ae0b4..0b1f1ed 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.2.12 +1.2.13