From c3c4176151394ca91ab56d8ecd370d107285aee9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 1 Sep 2016 16:33:28 +0200 Subject: system-restore: Support new webif (modularized) --- scripts/system-restore | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/system-restore b/scripts/system-restore index bb2967a..b23a613 100755 --- a/scripts/system-restore +++ b/scripts/system-restore @@ -116,12 +116,7 @@ if [ $RES_OPENSLX -eq 1 ]; then # Since we came that far we'll delete some old configs (if existent) rm -rf /opt/ldadp/{configs,pid,logs}/* /opt/openslx/configs/* /srv/openslx/www/boot/default/config.tgz 2> /dev/null # Force triggering IP detection/setting, which should in turn regenerate ldadp configs and launch ldadp instances if applicable - echo "UPDATE openslx.property SET value = 'invalid' WHERE name = 'server-ip' LIMIT 1" | mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 - # Try to update the db (if required) - ( - cd /srv/openslx/www/slx-admin - ./install-all - ) + mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 -e "UPDATE openslx.property SET value = 'invalid' WHERE name = 'server-ip' LIMIT 1" tar --ignore-failed-read -x -f files.tgz -C / RET=$? @@ -131,6 +126,30 @@ if [ $RES_OPENSLX -eq 1 ]; then # Make sure the directory tree is owned by taskmanager, as tar will create intermediate # directories as owned by root if they do not exist. chown -R taskmanager /srv/openslx/www/boot /opt/openslx/configs + + # Try to update the db (if required) + ( + cd /srv/openslx/www/slx-admin + ./install-all + ) + + # config.tgz symlink -> db entry + if [ -L /srv/openslx/www/boot/default/config.tgz ]; then + CONFTGZ=$(readlink /srv/openslx/www/boot/default/config.tgz | sed "s/'/\\\'/g") + echo "Config.tgz links to '$CONFTGZ'" + mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 -e "INSERT IGNORE INTO openslx.configtgz_location (locationid, configid) SELECT 0, configid FROM openslx.configtgz WHERE filepath = '$CONFTGZ' LIMIT 1" \ + || echo "Could not convert default config.tgz setting - do so manually" + rm -f -- /srv/openslx/www/boot/default/config.tgz + fi + + sleep 0.5 + for i in 1 1 1 1 1 2 2 3 4 END; do + CB=$(sudo -u www-data -n php /srv/openslx/www/slx-admin/api.php cb) + [ "x$CB" != "xTrue" ] && break + [ "$i" = "END" ] && break + sleep $i + done + fi rm -rf -- "$DIR" -- cgit v1.2.3-55-g7522