From 80e6f27157784b76c77eb03309ddf8781eaf0869 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 29 Sep 2015 17:00:37 +0200 Subject: [PATCH] MBR recovery proposal --- hashboot.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hashboot.sh b/hashboot.sh index 7996ea1..c297e68 100755 --- a/hashboot.sh +++ b/hashboot.sh @@ -109,6 +109,21 @@ then do tar -xzpPvwf ${BACKUP_FILE} ${file} [ $? != 0 ] && echo "Error restoring ${file} from backup, continuing" + # If the MBR is to be recovered, ask if it really should be copied to /dev/sda. + # Should be no problem to do it automatically, but it is untested and would + # be really bad if there is an error. + if [ "$file" == ${MBR_TMP} ] + then + echo "Backup of MBR copied to ${MBR_TMP}, copy it to /dev/sda? (DANGEROUS) [y/N] " + read -r yesno + if [ "${yesno}" == "y" ] + then + cp ${MBR_TMP} /dev/sda + else + echo "MBR not recovered, you can copy it manually with:" + echo "cp ${MBR_TMP} /dev/sda" + fi + fi done else echo "Usage: ${0} index|check|recover" >&2