always execute extension script after upgrade

Always execute extension script after upgrade from WebGUI, code changes.
This commit is contained in:
JRGTH
2025-09-14 05:30:35 -04:00
parent 8a98bc7f2b
commit 50e465f5e2
4 changed files with 30 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.2.02......Always execute extension script after upgrade from WebGUI, code changes.
1.2.01......Fix extension script missing statement preventing for new installs.
1.2.00......Re-add Linux jail feature, WebGUI fixes and overall improvements.
1.1.53......Code changes, handle osrelease parameter update in bastille-init.

View File

@@ -111,7 +111,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|/${BASTILLE_DIR}||")
BASTILLE_ZFS_PREFIX_TRIM=$(echo "${bastille_zfs_prefix}" | sed "s|/${APPNAME}||")
fi
# Check bastille ZFS config match on disk ZFS config.
BASTILLE_CONFIG_DISK=$(zfs list -H "${bastille_prefix}" 2>/dev/null | awk '{print $1}')
@@ -308,6 +308,8 @@ extension_upgrade()
# Compare version files and fetch latest package if available.
if [ -f "${CWDIR}/update/version" ]; then
UPDATEVER_FULL=$(cat ${CWDIR}/update/version)
CURRENTVER_FULL=$(cat ${CWDIR}/version)
UPDATEVER=$(cat ${CWDIR}/update/version | tr -d .)
CURRENTVER=$(cat ${CWDIR}/version | tr -d .)
if [ "${UPDATEVER}" -gt "${CURRENTVER}" ]; then
@@ -325,6 +327,11 @@ extension_upgrade()
echo "${DATE}: Extension upgraded to ${UPDATEVERSION}" >> ${EXTLOGFILE}
echo "Extension upgraded to version ${UPDATEVERSION}"
echo "Extension package upgrade completed!"
if [ "${CURRENTVER}" -le "1153" ]; then
echo "***********************************************************************************"
echo "* WARNING: System reboot is required when upgrading from v${CURRENTVER_FULL} to v${UPDATEVER_FULL} *"
echo "***********************************************************************************"
fi
else
echo "Extension is on the latest version!"
rm -R ${CWDIR}/update
@@ -1299,35 +1306,41 @@ rc_params()
if [ -n "${bastille_zfs_zpool}" ]; then
if zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1; then
# Check and don't allow child datasets in bastille_zfs_zpool.
if echo "${bastille_zfs_zpool}" | grep -q '\/'; then
zfs_support_error
exit 1
fi
# Check and make sure bastille_zfs_prefix end with "bastille".
if ! echo "${bastille_zfs_prefix}" | grep -qw "${APPNAME}"; then
zfs_support_error
exit 1
fi
# Check bastille ZFS config match on disk ZFS config if activation is already enabled in the config file.
if sysrc -f ${CWDIR}${EXTCONF} -qc ZFS_SUPPORT=YES && sysrc -f ${CWDIR}${EXTCONF} -qc ZFS_ACTIVATED=YES; then
if [ "${BASTILLE_CONFIG_DISK}" != "${BASTILLE_CONFIG_FILE}" ]; then
zfs_support_error
exit 1
else
# Check and don't allow child datasets in bastille_zfs_zpool.
if echo "${bastille_zfs_zpool}" | grep -q '\/'; then
zfs_support_error
exit 1
fi
fi
fi
# Perform some checks against on-disk and file configurations.
if zfs list "${bastille_zfs_zpool}/${BASTILLE_ZFS_PREFIX_TRIM}/${BASTILLE_DIR}" >/dev/null 2>&1; then
if zfs list "${bastille_zfs_zpool}/${BASTILLE_ZFS_PREFIX_TRIM}/${APPNAME}" >/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}/${BASTILLE_DIR}" ]; then
[ "${bastille_zfs_prefix}" = "${BASTILLE_ZFS_PREFIX_TRIM}/${APPNAME}" ]; then
# Looks like ZFS support is available for activation.
zfs_support_avail
elif zfs list "${bastille_zfs_zpool}/${BASTILLE_DIR}" >/dev/null 2>&1; then
elif zfs list "${bastille_zfs_zpool}/${APPNAME}" >/dev/null 2>&1; then
zfs_support_enabled
elif zfs list "${bastille_zfs_zpool}" >/dev/null 2>&1 && \
[ "${BASTILLE_ZFS_PREFIX_TRIM}" = "${BASTILLE_DIR}" ]; then
[ "${BASTILLE_ZFS_PREFIX_TRIM}" = "${APPNAME}" ]; then
# Looks like ZFS support is available for activation.
zfs_support_avail
elif zfs list "${bastille_zfs_zpool}/${BASTILLE_DIR}" >/dev/null 2>&1; then
elif zfs list "${bastille_zfs_zpool}/${APPNAME}" >/dev/null 2>&1; then
zfs_support_enabled
else
zfs_support_error

View File

@@ -85,6 +85,9 @@ if ($_POST) {
$output = [];
exec($cmd,$output,$return_val);
if($return_val == 0):
// Execute extension script after upgrade for convenience.
// This will cause the script to early trigger zfs config checks.
exec("{$rootfolder}/bastille-init");
ob_start();
include("{$logevent}");
$ausgabe = ob_get_contents();

View File

@@ -1 +1 @@
1.2.01
1.2.02