diff options
author | Simon Rettberg | 2016-09-01 16:33:28 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-09-01 16:33:28 +0200 |
commit | c3c4176151394ca91ab56d8ecd370d107285aee9 (patch) | |
tree | b12c9bbfb48e31f8c8dc7c6c322e734b8ba53d0f /scripts/system-restore | |
parent | [scripts] system-restore: Use new install-all script for DB update (diff) | |
download | tmlite-bwlp-c3c4176151394ca91ab56d8ecd370d107285aee9.tar.gz tmlite-bwlp-c3c4176151394ca91ab56d8ecd370d107285aee9.tar.xz tmlite-bwlp-c3c4176151394ca91ab56d8ecd370d107285aee9.zip |
system-restore: Support new webif (modularized)
Diffstat (limited to 'scripts/system-restore')
-rwxr-xr-x | scripts/system-restore | 31 |
1 files changed, 25 insertions, 6 deletions
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" |