summaryrefslogtreecommitdiffstats
path: root/scripts/system-restore
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-22 18:25:24 +0200
committerSimon Rettberg2015-09-22 18:25:24 +0200
commitca2aef36c8c280f61d14ba16f9efc03e014e3162 (patch)
tree36f4fc1e6c017b493cb677c7bd08a6ff1315f2f6 /scripts/system-restore
parentUpdate (diff)
downloadtmlite-bwlp-ca2aef36c8c280f61d14ba16f9efc03e014e3162.tar.gz
tmlite-bwlp-ca2aef36c8c280f61d14ba16f9efc03e014e3162.tar.xz
tmlite-bwlp-ca2aef36c8c280f61d14ba16f9efc03e014e3162.zip
Add dozmod database upgrade script to restore feature
Diffstat (limited to 'scripts/system-restore')
-rwxr-xr-xscripts/system-restore11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/system-restore b/scripts/system-restore
index 7b0de12..b9fe9d0 100755
--- a/scripts/system-restore
+++ b/scripts/system-restore
@@ -1,5 +1,7 @@
#!/bin/bash
+TMDIR="/opt/taskmanager"
+
BACKUP="$1"
if [ -z "$BACKUP" ] || [ ! -f "$BACKUP" ]; then
echo "Backup file not found: $BACKUP"
@@ -77,16 +79,24 @@ if [ $RES_OPENSLX -eq 1 -a ! -f files.tgz ]; then
exit 1
fi
+echo "-- Restoring Database"
if [ $DB_OLD -eq 1 ]; then
+ echo "--- Importing legacy database dump"
+ # Restoring from dozmod v1.0 db
mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 < db.sql
RET=$?
+ echo "--- Trying to convert dozmod data (this might not work too well...)"
+ mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 < "${TMDIR}/data/dozmod-upgrade.sql"
else
+ # Restoring from v1.1+ db
RET=0
if [ $RES_SAT -eq 1 ]; then
+ echo "--- Importing system configuration"
mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 < sat.sql
RET=$?
fi
if [ $RET -eq 0 -a $RES_OPENSLX -eq 1 ]; then
+ echo "--- Importing dozmod database (vms/lectures meta data)"
mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 < openslx.sql
RET=$?
fi
@@ -98,6 +108,7 @@ if [ $RET -ne 0 ]; then
fi
if [ $RES_OPENSLX -eq 1 ]; then
+ echo "-- Restoring system files"
# 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