summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/live-installer/restore_km_db_chroot.sh
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2008-11-05 20:45:30 (GMT)
committerJames Meyer <james.meyer@operamail.com>2008-11-05 20:45:30 (GMT)
commitdaa272b5f5dac869f2c247452d9c1c72f885dda5 (patch)
tree1600d48f1ab098a1eb348116547b310d97721ae2 /abs/core-testing/live-installer/restore_km_db_chroot.sh
parent532096037336792692e4f523535142fb35f00a47 (diff)
downloadlinhes_pkgbuild-daa272b5f5dac869f2c247452d9c1c72f885dda5.zip
linhes_pkgbuild-daa272b5f5dac869f2c247452d9c1c72f885dda5.tar.gz
linhes_pkgbuild-daa272b5f5dac869f2c247452d9c1c72f885dda5.tar.bz2
Add KM->LinHES upgrade support.
Very basic support only imports the hostname and restores the database(if needed). All other information is left behind.
Diffstat (limited to 'abs/core-testing/live-installer/restore_km_db_chroot.sh')
-rw-r--r--abs/core-testing/live-installer/restore_km_db_chroot.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/abs/core-testing/live-installer/restore_km_db_chroot.sh b/abs/core-testing/live-installer/restore_km_db_chroot.sh
new file mode 100644
index 0000000..9467ffd
--- /dev/null
+++ b/abs/core-testing/live-installer/restore_km_db_chroot.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+. /etc/profile
+. /etc/systemconfig
+set -x
+#myhost=`cat /etc/hostname`
+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
+ echo "restoring old database"
+ gunzip -c /myth/backup/mythconverg.sql.gz > /myth/backup/mythconverg.sql
+ mysql mythconverg < /myth/backup/mythconverg.sql
+
+
+ if [ -d /var/lib/mysql/mythconverg ]
+ then
+ status=0
+ fi
+ fi
+ fi
+ done
+ rm -f /myth/backup/mythconverg.sql
+ else
+ exit 0
+ fi
+
+#/etc/rc.d/mysqld stop
+#umount /proc
+
+
+