Added post upgrade function for convenience, cleanup

Added post upgrade function for convenience, cleanup obsolete code.
This commit is contained in:
JRGTH
2025-09-14 08:03:36 -04:00
parent 50e465f5e2
commit d70bc5a15b
4 changed files with 21 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.2.03......Added post upgrade function for convenience, cleanup obsolete code.
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.

19
bastille-init Executable file → Normal file
View File

@@ -332,6 +332,8 @@ extension_upgrade()
echo "* WARNING: System reboot is required when upgrading from v${CURRENTVER_FULL} to v${UPDATEVER_FULL} *"
echo "***********************************************************************************"
fi
# Tell the extension was upgraded.
sysrc -f ${CWDIR}${EXTCONF} EXTENSION_UPGRADED="1" >/dev/null 2>&1
else
echo "Extension is on the latest version!"
rm -R ${CWDIR}/update
@@ -1197,6 +1199,22 @@ get_versions()
exit 0
}
post_upgrade()
{
# Check/apply for required/pending updates/fixes if any.
# This file will be removed after success execution.
if sysrc -f ${CWDIR}${EXTCONF} -qc EXTENSION_UPGRADED=1; then
if [ -f "${CWDIR}/post_upgrade.sh" ]; then
echo "Executing post_upgrade.sh file..."
${CWDIR}/post_upgrade.sh
sleep 5
else
echo "Nothing to do."
fi
sysrc -f ${CWDIR}${EXTCONF} EXTENSION_UPGRADED="0" >/dev/null 2>&1
fi
}
ext_start()
{
if sysrc -f ${CWDIR}${EXTCONF} -qc LINUX_COMPAT_SUPPORT=YES; then
@@ -1221,6 +1239,7 @@ ext_start()
fi
if [ $? -eq 0 ]; then
post_upgrade
MSG="script has been started successfully!"
logger -t ${SCRIPTNAME} ${MSG}
exit 0

View File

@@ -85,9 +85,6 @@ 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.02
1.2.03