summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--satellit_installer/includes/90-patch_slxadmin.inc7
-rwxr-xr-xsatellit_installer/static_files/slxadmin-init/init.sh3
-rwxr-xr-xsatellit_upgrader/pack-update.sh1
-rw-r--r--satellit_upgrader/updater.template.sh14
4 files changed, 20 insertions, 5 deletions
diff --git a/satellit_installer/includes/90-patch_slxadmin.inc b/satellit_installer/includes/90-patch_slxadmin.inc
index d6d6e88..f254ae7 100644
--- a/satellit_installer/includes/90-patch_slxadmin.inc
+++ b/satellit_installer/includes/90-patch_slxadmin.inc
@@ -41,8 +41,11 @@ install_slxadmin_db () {
echo "# Installing slx-admin database"
sudo -n -u www-data ./install-all || perror "Could not install slx-admin database"
cd - 1>/dev/null
- # Fill with data we need
- php "${BASEDIR}/static_files/slxadmin-init/slxadmin-init.php" || perror "Filling tables with required data failed"
+ # Copy init script for later use (restoring backup)
+ mkdir -p "/opt/openslx/restore.d"
+ cp -a "${BASEDIR}/static_files/slxadmin-init" "/opt/openslx/restore.d/" || perror "Could not copy slxadmin-init"
+ # Fill database with data we need
+ /opt/openslx/restore.d/slxadmin-init/init.sh || perror "Filling tables with required data failed"
# Reset with original template for firstboot script
copy_slxadmin_config
# appending a variable with satellite server build date/time to slx-admin config:
diff --git a/satellit_installer/static_files/slxadmin-init/init.sh b/satellit_installer/static_files/slxadmin-init/init.sh
new file mode 100755
index 0000000..b48a1bf
--- /dev/null
+++ b/satellit_installer/static_files/slxadmin-init/init.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec sudo -n -u www-data php "$( dirname "$0" )/slxadmin-init.php"
diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh
index fbe23cd..3c889f5 100755
--- a/satellit_upgrader/pack-update.sh
+++ b/satellit_upgrader/pack-update.sh
@@ -233,6 +233,7 @@ if [ -z "$LEAN" ]; then
addinstallfile "tftpd/tftpd-remap"
addinstallfile "slxadmin-init/gpg-key.asc"
addinstallfile "slxadmin-init/slxadmin-init.php"
+ addinstallfile "slxadmin-init/init.sh"
# TODO: Unify more
source ../satellit_installer/includes/10-sudo_config.inc
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index f71846d..1756bc6 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -506,9 +506,11 @@ if [ -n "$TGZ_SLXADMIN" ]; then
rm -f -- "/srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json"
ln -s "${PATH_SLXADMINCACHE}/baseconfig-bwidm_settings.json" /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json || \
pwarning "Could not set link ${PATH_SLXADMINCACHE}/baseconfig-bwidm_settings.json to /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json - do so manually if you need bwIDM login on client computers"
- # run init script
- if [ -s "$FILEDIR/slxadmin-init/slxadmin-init.php" ]; then
- php "$FILEDIR/slxadmin-init/slxadmin-init.php" || perror "Error running slx-admin init script"
+ # update init script
+ if [ -d "${FILEDIR}/slxadmin-init" ]; then
+ rm -rf -- /opt/openslx/restore.d/slxadmin-init
+ mkdir -p /opt/openslx/restore.d || perror "Could not create /opt/openslx/restore.d"
+ cp -a "${FILEDIR}/slxadmin-init" /opt/openslx/restore.d/
fi
echo "Web interface upgrade complete"
fi
@@ -851,6 +853,12 @@ for service in "${!restart[@]}"; do
restart_service "$service"
done
+# Run all post-restore scripts
+for i in /opt/openslx/restore.d/*/init.sh; do
+ [ -x "$i" ] || continue
+ "$i" || pwarning "ERROR running post-restore script $i: $?"
+done
+
# Patch the update version in /etc/motd
sed -r -i 's/(bwLehrpool\sSatelliten-Server,\sVersion\s[WS]Sem20[12][0-9]\s[1-9]\.[0-9])(\s\[Update\s[0-9]\.[0-9][a-z]?\])?/\1 \[Update '"${SLXADMIN_FOOTER//v/}"'\]/g' /etc/motd