diff options
author | Britney Fransen <brfransen@gmail.com> | 2010-06-09 21:01:12 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2010-06-09 21:01:12 (GMT) |
commit | 1dbb59aab559f250818ea15c834fbd2228849dce (patch) | |
tree | d33785188f53a48010b36635a870106020ced8a5 /abs/core-testing/LinHES-system/bin/mythrestore | |
parent | 8690fb6d1fe3e2ee832a2b21a8085290ef3721e0 (diff) | |
download | linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.zip linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.tar.gz linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.tar.bz2 |
LinHES-system: Update mythbackup and mythrestore to show OSD status during backup and restore. Adds description to the menu item showing the last backup and restore. Only displays in themes that show description line in menu items. Closes #173
Diffstat (limited to 'abs/core-testing/LinHES-system/bin/mythrestore')
-rwxr-xr-x | abs/core-testing/LinHES-system/bin/mythrestore | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/abs/core-testing/LinHES-system/bin/mythrestore b/abs/core-testing/LinHES-system/bin/mythrestore index 76b76a3..0ab5c86 100755 --- a/abs/core-testing/LinHES-system/bin/mythrestore +++ b/abs/core-testing/LinHES-system/bin/mythrestore @@ -7,6 +7,21 @@ } #---------------------------------------------------------------------------- +# Function to display status onscreen +osd() +# Arg_1 = display text Arg_2 = delay time Arg_3 = line num +{ + TEXT=$1 + killall -9 osd_cat + if [ $3 -gt 1 ]; then + for ((i=2; i <= $3 ; i++)) + do + TEXT="\n"$TEXT + done + fi + printf "$TEXT" | osd_cat --lines=6 --pos=middle --align=center --delay=$2 --color white -O 2 -u black -f -adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-* & +} + do_file_updates() { # A function because we need to do this in two places echo "Doing any needed file updates..." [ -n "$UPDATE_FILES" -a -f "$UPDATE_FILES" -a -x "$UPDATE_FILES" ] && @@ -39,6 +54,7 @@ lock_myth # Play a sound to let you know I'm starting. play_sound restore.wav +export DISPLAY=:0.0 # Doing this while the backend is active could be BAD. stop_mythbackend @@ -46,6 +62,7 @@ stop_mythbackend # If the standard backup file exists we try to restore the files based # on our restore list. if compression=$(compression_type "$BACKUP_TAR") ; then + osd "Restoring files..." 0 1 echo "Starting the restore of files..." cd / expand -c $BACKUP_TAR$compression | @@ -59,8 +76,11 @@ 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 + osd "Recreating database..." 0 2 echo "Recreating the db..." + sleep 1 $MYSQLADMIN -u root create $DATABASE + osd "Restoring database..." 0 3 echo "Restoring the data (long)..." expand -c $BACKUP_SQL$compression | mysql_stdin echo "Doing any needed db updates..." @@ -69,19 +89,32 @@ if compression=$(compression_type "$BACKUP_SQL") ; then echo "Completed the DB restore." fi +osd "Testing restore..." 0 4 echo "Sanity checking your restore..." play_sound vr.wav # Play a sound to let you know the outcome. if check_files_and_tables $RESTORE_LIST ; then + osd "Restore completed successfully." 5 5 echo "Restore passes all checks." + COMPLETE_MSG="Last restore completed on `date '+%D @ %-I:%M %p'`" play_sound restored.wav STATUS=0 else + osd "Restore FAILED." 5 5 echo "The restore failed or was already modified!" + COMPLETE_MSG="Last restore FAILED on `date '+%D @ %-I:%M %p'`" play_sound rf.wav STATUS=1 fi +# Add Last restore status to menu item +if grep "<description>" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml >/dev/null 2>&1 +then + sed -i "s_\<description\>.*\<description\>_description\>$COMPLETE_MSG\<\/description_" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml +else + sed -i.orig " /NONE/ i\ \<description\>$COMPLETE_MSG\<\/description\>" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml +fi + # Make any updates _after_ we verify the backup... do_db_updates do_file_updates |