summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-system/bin/mythrestore
diff options
context:
space:
mode:
authorTom Culliton <culliton@x2.(none)>2009-01-11 01:55:28 (GMT)
committerTom Culliton <culliton@x2.(none)>2009-01-11 01:55:28 (GMT)
commiteb00fec42b6ccd143a145c89fff284969aa738be (patch)
tree60c2a07ee19660e58b899949a3d286b8fa57e457 /abs/core-testing/LinHES-system/bin/mythrestore
parent8aaf1c6cb3aca9ee0c95b9b5464c6fa40587e56b (diff)
downloadlinhes_pkgbuild-eb00fec42b6ccd143a145c89fff284969aa738be.zip
linhes_pkgbuild-eb00fec42b6ccd143a145c89fff284969aa738be.tar.gz
linhes_pkgbuild-eb00fec42b6ccd143a145c89fff284969aa738be.tar.bz2
Updates to make the backup and restore scripts work for Arch Linux and be
more portable in general. Also use the library facilities for checking on the existence of prerequisites.
Diffstat (limited to 'abs/core-testing/LinHES-system/bin/mythrestore')
-rwxr-xr-xabs/core-testing/LinHES-system/bin/mythrestore22
1 files changed, 11 insertions, 11 deletions
diff --git a/abs/core-testing/LinHES-system/bin/mythrestore b/abs/core-testing/LinHES-system/bin/mythrestore
index c13d357..7fce371 100755
--- a/abs/core-testing/LinHES-system/bin/mythrestore
+++ b/abs/core-testing/LinHES-system/bin/mythrestore
@@ -1,10 +1,7 @@
#!/bin/bash
-# Let's prevent mythshutdown from shutting down the system.
-/usr/bin/mythshutdown --lock
-
#----------------------------------------------------------------------------
-. $LinHES_ROOT/bin/backupcommon || {
+. /usr/LH/bin/backupcommon || {
echo 1>&2 "Can not load common settings!"
exit 1
}
@@ -18,7 +15,7 @@ do_file_updates() { # A function because we need to do this in two places
do_db_updates() {
# We need to redo this since we just restored the old settings...
- /usr/bin/mythshutdown --lock
+ lock_myth
# This is gross, but makes sure that the lock count has a sane value...
mysql_cmd "update settings set data = '1' where value = 'MythShutdownLock'"
@@ -37,11 +34,14 @@ do_db_updates() {
mysql_cmd "drop table mythweb_sessions" >/dev/null 2>&1
}
+# Let's prevent mythshutdown from shutting down the system.
+lock_myth
+
# Play a sound to let you know I'm starting.
play_sound restore.wav
# Doing this while the backend is active could be BAD.
-/etc/init.d/mythtv-backend stop
+stop_mythbackend
# If the standard backup file exists we try to restore the files based
# on our restore list.
@@ -49,8 +49,8 @@ if compression=$(compression_type "$BACKUP_TAR") ; then
echo "Starting the restore of files..."
cd /
expand -c $BACKUP_TAR$compression |
- /bin/tar xpvf - $RESTORE_LIST $EXCLUSION 2>&1 |
- /bin/sed -e '/Error exit delayed from previous errors/d'
+ $TAR xpvf - $RESTORE_LIST $EXCLUSION 2>&1 |
+ $SED -e '/Error exit delayed from previous errors/d'
echo "Completed the restore of files."
fi
@@ -58,9 +58,9 @@ fi
if compression=$(compression_type "$BACKUP_SQL") ; then
echo "Starting the DB restore, this can take a while..."
echo "Clearing out the existing skeleton..."
- mysql_stdin < $DROP_SQL
+ #mysql_stdin < $DROP_SQL
echo "Recreating the db..."
- /usr/bin/mysqladmin -u root create $DATABASE
+ $MYSQLADMIN -u root create $DATABASE
echo "Restoring the data (long)..."
expand -c $BACKUP_SQL$compression | mysql_stdin
echo "Doing any needed db updates..."
@@ -87,6 +87,6 @@ do_db_updates
do_file_updates
# Now it's more or less safe to restart the backend.
-/etc/init.d/mythtv-backend stop ; /etc/init.d/mythtv-backend start
+start_mythbackend
exit $STATUS