From 6526e29a9d5425c0d294f7a376956b8440cb5631 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sun, 14 Dec 2008 10:25:54 -0600 Subject: if /myth/backup/mythconverg.sql is not present check for the file in /root/backup/ closes FS#60 --- abs/core-testing/LinHES-config/PKGBUILD | 2 +- abs/core-testing/LinHES-config/install_proxy.sh | 23 +++++++++++++++++----- .../LinHES-config/restore_km_db_chroot.sh | 8 ++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index 4be90e0..b76eb83 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=109 +pkgrel=114 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 92b90dc..f251c70 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -14,6 +14,7 @@ run=$MV_ROOT/bin/install_functions.sh . /etc/systemconfig 2>/dev/null . $MV_ROOT/bin/networkconfig.sh CMDLINE=$(cat /proc/cmdline) +BACKUPFILE="/myth/backup/mythconverg.sql.gz" #TEMPNET="Hostip"$default_interface #eval MYTHIP=\$${TEMPNET} @@ -53,11 +54,13 @@ function apply_new_auth () { function backup_sql_check { - - if [ -f $mountpoint/myth/backup/mythconverg.sql.gz ] + if [ -f ${mountpoint}${BACKUPFILE} ] then + + echo "found ${mountpoint}${BACKUPFILE} " return 0 else + echo "did not find ${mountpoint}${BACKUPFILE} " return 1 fi } @@ -66,6 +69,14 @@ function upgrade_mount_search { MYTH_P=`cat /tmp/etc/fstab |grep /myth| awk ' {print $1 '} ` umount $mountpoint/myth mount $MYTH_P $mountpoint/myth + backup_sql_check + if [ $? = 1 ] + then + mkdir -p /new_boot/root/backup + cp -f /tmp/mythconverg.sql.gz /new_boot/root/backup/mythconverg.sql.gz + BACKUPFILE="/root/backup/mythconverg.sql.gz" + echo "setting BACKUPFILE to $BACKUPFILE" + fi return 0 } @@ -237,7 +248,8 @@ function upgrade () { cp /etc/mtab "$mountpoint"/etc/mtab cp -f /etc/systemconfig "$mountpoint"/etc #make sure mythconverg.sql.gz is present - if [ ! backup_sql_check ] + backup_sql_check + if [ $? = 1 ] then upgrade_mount_search fi @@ -284,12 +296,12 @@ function upgrade () { chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" > /tmp/chrootdb.out else #proceed as normal - if [ -f /new_boot/myth/backup/mythconverg.sql.gz ] + if [ -f "$mountpoint"/$BACKUPFILE ] then echo "--------------------------------" echo "Restoring database" echo "--------------------------------" - chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out + chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE" > /tmp/chrootdb_km.out else echo "--------------------------------" echo "Couldn't find backup file, installing new database" @@ -385,6 +397,7 @@ echo "-----------------------------------------------------------------------3-- if [ $? = 1 ] then $run mount_it $disk + [ -e "/new_boot/root/backup/mythconverg.sql.gz" ] && cp /new_boot/root/backup/mythconverg.sql.gz /tmp if [ -f /new_boot/etc/systemconfig ] then ###########ADD templates 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 2f5ba72..7ff6faf 100644 --- a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh +++ b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh @@ -30,11 +30,11 @@ if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] pacman --noconfirm -R mythdb-initial pacman --noconfirm -S mythdb-initial - if [ -f /myth/backup/mythconverg.sql.gz ] + if [ -f $DBFILE ] then echo "restoring old database" - gunzip -c /myth/backup/mythconverg.sql.gz > /myth/backup/mythconverg.sql - mysql mythconverg < /myth/backup/mythconverg.sql + gunzip -c $DBFILE > /tmp/mythconverg.sql + mysql mythconverg < /tmp/mythconverg.sql else echo "Could not restore old database, mythconverg.sql is missing." touch /tmp/.upgrade_db_failed @@ -47,7 +47,7 @@ if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] fi fi done - rm -f /myth/backup/mythconverg.sql + rm -f /tmp/mythconverg.sql else exit 0 fi -- cgit v0.12