summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-02-24 18:21:28 +0100
committerSimon Rettberg2020-02-24 18:21:28 +0100
commit8cbffc8117a6489ce1a4551ad3427a500526dcbe (patch)
tree0f72ed4f74e0cb38724e086eb1f845552aa91da8
parentscripts/mount-store: Special case cifs wrt. stage4 permissions (diff)
downloadtmlite-bwlp-8cbffc8117a6489ce1a4551ad3427a500526dcbe.tar.gz
tmlite-bwlp-8cbffc8117a6489ce1a4551ad3427a500526dcbe.tar.xz
tmlite-bwlp-8cbffc8117a6489ce1a4551ad3427a500526dcbe.zip
scripts:system-restore: Don't import minilinux_* from backup
This would be out of sync with what's actually on the filesystem, so instead, keep the current values by dumping them and importing them again right after the dump from the backup has been imported. This isn't too elegant, but the sql dumps in the backup files would wipe the entire DB, so I can't think of a better way that wouldn't be overly complicated.
-rwxr-xr-xscripts/system-restore9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/system-restore b/scripts/system-restore
index a044d2d..d65460e 100755
--- a/scripts/system-restore
+++ b/scripts/system-restore
@@ -101,8 +101,17 @@ else
fi
if [ $RET -eq 0 -a $RES_OPENSLX -eq 1 ]; then
echo "--- Importing system configuration"
+ # Backup and restore minilinux metadata -- doesn't make sense to import this from the backup
+ mtmp="$( mktemp )"
+ mysqldump --defaults-extra-file=/etc/mysql/debian.cnf --add-locks --default-character-set=utf8 openslx minilinux_source minilinux_branch minilinux_version > "${mtmp}" 2> /dev/null
+ mlret=$?
mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 < openslx.sql
RET=$?
+ if [ "$mlret" = 0 ]; then
+ mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 --database=openslx -e "DROP TABLE IF EXISTS minilinux_version, minilinux_branch, minilinux_source"
+ mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 --database=openslx < "${mtmp}"
+ fi
+ rm -f -- "$mtmp"
fi
fi