From 8cbffc8117a6489ce1a4551ad3427a500526dcbe Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 24 Feb 2020 18:21:28 +0100 Subject: 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. --- scripts/system-restore | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- cgit v1.2.3-55-g7522