From 1c72f48f8dfa6a8beda6724852237174222a8a40 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sat, 15 Nov 2008 11:39:45 -0600 Subject: Check if the restore file for mythconverg is present. If the file can not be found then install a new database and abort the restore process. Also display a message stating the above. closes FS#7 --- abs/core-testing/LinHES-config/PKGBUILD | 2 +- abs/core-testing/LinHES-config/install_proxy.sh | 16 +++++++++++++++- abs/core-testing/LinHES-config/restore_km_db_chroot.sh | 15 +++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index b5023d3..0c1464a 100755 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=20 +pkgrel=25 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan) diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh index ae3f316..113a3ee 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -270,7 +270,21 @@ function upgrade () { #wrap this in a network check_network, no need to update the db if the import worked. ##### do I need to start mysql? /etc/rc.d/mysqld stop - chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out + if [ -f /myth/backup/mythconverg.sql.gz ] + then + echo "--------------------------------" + echo "Restoring database" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out + else + echo "--------------------------------" + echo "Couldn't find backup file, installing new database" + echo "--------------------------------" + touch /tmp/.upgrade_db_failed + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" > /tmp/chrootdb.out + fi + + if [ -f /tmp/etc/KnoppMyth-version ] then chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings diff --git a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh index 35e8fbd..17ad113 100644 --- a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh +++ b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh @@ -29,12 +29,19 @@ if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] #load database pacman --noconfirm -R mythdb-initial pacman --noconfirm -S mythdb-initial - echo "restoring old database" - gunzip -c /myth/backup/mythconverg.sql.gz > /myth/backup/mythconverg.sql - mysql mythconverg < /myth/backup/mythconverg.sql + + if [ -f /myth/backup/mythconverg.sql.gz ] + then + echo "restoring old database" + gunzip -c /myth/backup/mythconverg.sql.gz > /myth/backup/mythconverg.sql + mysql mythconverg < /myth/backup/mythconverg.sql + + else + echo "Could not restore old database, mythconverg.sql is missing." + touch /tmp/.upgrade_db_failed + fi if [ -d /data/srv/mysql/mythconverg ] - #if [ -d /var/lib/mysql/mythconverg ] then status=0 fi -- cgit v0.12