summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-11-13 07:22:22 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-11-13 07:22:22 (GMT)
commitf1e3c5f9132ab7fdf1e1d33f6020a82a9869096a (patch)
tree6b681fc663d7f8a07863185f4313d39cedba655a /abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh
parent420f4c0c8157237d3b4b682a27db498b80c9e0f3 (diff)
downloadlinhes_pkgbuild-f1e3c5f9132ab7fdf1e1d33f6020a82a9869096a.zip
linhes_pkgbuild-f1e3c5f9132ab7fdf1e1d33f6020a82a9869096a.tar.gz
linhes_pkgbuild-f1e3c5f9132ab7fdf1e1d33f6020a82a9869096a.tar.bz2
LinHES-config-22: first check in of LinHES-config-22
Diffstat (limited to 'abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh')
-rw-r--r--abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh b/abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh
new file mode 100644
index 0000000..e72e8c2
--- /dev/null
+++ b/abs/core-testing/LinHES-config-22/restore_km_db_chroot.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+. /etc/profile
+. /etc/systemconfig
+. $MV_ROOT/bin/install_functions.sh
+
+myhost=$hostname
+hostname $myhost
+mount -t proc none /proc
+DBFILE=$1
+
+if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ]
+ then
+ #restore database
+ pacman --noconfirm -Sf mysql
+ status=1
+ mysqlstatus=1
+ while [ ! $status = 0 ]
+ do
+ /etc/rc.d/mysqld stop
+ sleep 1
+ /etc/rc.d/mysqld start
+ mysqlstatus=$?
+ if [ $mysqlstatus = 0 ]
+ then
+ mysql -e "show databases;"
+ showstatus=$?
+ if [ $showstatus = 0 ]
+ then
+ #load database
+ pacman --noconfirm -R mythdb-initial
+ pacman --noconfirm -S mythdb-initial
+
+ if [ -f $DBFILE ]
+ then
+ echo "restoring old database"
+ gunzip -c $DBFILE > /tmp/mythconverg.sql
+ mysql mythconverg < /tmp/mythconverg.sql
+ update_db_settings HostServiceMythWEB "1"
+ echo 'UseMythWEB="1"' >> /etc/systemconfig
+ else
+ echo "Could not restore old database, mythconverg.sql is missing."
+ touch /tmp/.upgrade_db_failed
+ fi
+
+ if [ -d /data/srv/mysql/mythconverg ]
+ then
+ status=0
+ fi
+ fi
+ fi
+ done
+ rm -f /tmp/mythconverg.sql
+ else
+ exit 0
+ fi
+
+#/etc/rc.d/mysqld stop
+#umount /proc
+
+
+