Fallback for custom bastille prefix name

Fallback for custom bastille prefix name, for example capitalized "Bastille" prefix.
This commit is contained in:
JRGTH
2025-10-05 01:06:40 -04:00
parent 3e8e2305ae
commit fb036a29da
4 changed files with 14 additions and 8 deletions
+1
View File
@@ -3,6 +3,7 @@
====================== ======================
Version Description 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.12......Minor code improvements, clean stale pkg files on error.
1.2.11......Add all bastille Linux flavors bootstrap options. 1.2.11......Add all bastille Linux flavors bootstrap options.
1.2.10......Minor code improvements and cleanup. 1.2.10......Minor code improvements and cleanup.
Regular → Executable
+12 -7
View File
@@ -103,6 +103,11 @@ BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM=
# Get extension ZFS config info. # Get extension ZFS config info.
if [ "${bastille_zfs_enable}" = "YES" ] || [ "${bastille_zfs_enable}" = "yes" ]; then if [ "${bastille_zfs_enable}" = "YES" ] || [ "${bastille_zfs_enable}" = "yes" ]; then
if [ -n "${bastille_zfs_prefix}" ] && [ -n "${bastille_zfs_zpool}" ]; 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. # Always enforce ZFS activation below "/mnt/" from the extension.
if echo "${CWDIR}" | grep -q '/mnt/'; then if echo "${CWDIR}" | grep -q '/mnt/'; then
CWDIR_TRIM=$(echo "${CWDIR}" | sed "s|/mnt/||;s|/${bastille_zfs_prefix}||") 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 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}||") BASTILLE_ZFS_ZPOOL_MOUNTPOINT_TRIM=$(echo "${BASTILLE_ZFS_ZPOOL_MOUNTPOINT}" | sed "s|/mnt/||;s|/${bastille_zfs_prefix}||")
fi 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 fi
# Check bastille ZFS config match on disk ZFS config. # Check bastille ZFS config match on disk ZFS config.
BASTILLE_CONFIG_DISK=$(zfs list -H "${bastille_prefix}" 2>/dev/null | awk '{print $1}') BASTILLE_CONFIG_DISK=$(zfs list -H "${bastille_prefix}" 2>/dev/null | awk '{print $1}')
@@ -1341,7 +1346,7 @@ rc_params()
fi fi
# Check and make sure bastille_zfs_prefix end with "bastille". # 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 zfs_support_error
exit 1 exit 1
fi fi
@@ -1355,20 +1360,20 @@ rc_params()
fi fi
# Perform some checks against on-disk and file configurations. # 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. # Looks like ZFS support is already configured, then set parameters.
zfs_support_enabled zfs_support_enabled
elif zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1 && \ 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. # Looks like ZFS support is available for activation.
zfs_support_avail 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 zfs_support_enabled
elif zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1 && \ 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. # Looks like ZFS support is available for activation.
zfs_support_avail 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 zfs_support_enabled
else else
zfs_support_error zfs_support_error
Regular → Executable
View File
+1 -1
View File
@@ -1 +1 @@
1.2.12 1.2.13