Control panel option to remove backups

This commit is contained in:
Bob Mottram 2015-12-09 09:58:58 +00:00
parent 5023a63a37
commit 3d1d6ef345
1 changed files with 45 additions and 3 deletions

View File

@ -659,6 +659,46 @@ function format_drive {
any_key
}
function remove_backups {
drive=
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Remove backups from a USB drive" \
--radiolist $"Choose a drive:" 12 70 5 \
1 $"sda (Beaglebone Black)" off \
2 $"sdb" off \
3 $"sdc" off \
4 $"sdd" off \
5 $"Back to Backup and Restore menu" on 2> $data
sel=$?
case $sel in
1) return;;
255) return;;
esac
case $(cat $data) in
1) drive='sda';;
2) drive='sdb';;
3) drive='sdc';;
4) drive='sdd';;
5) return;;
esac
dialog --title $"Remove backups from a USB drive" \
--backtitle $"Freedombone Control Panel" \
--defaultno \
--yesno $"\nPlease confirm that you wish to remove backups from this drive\n\n ${drive}\n\nYou will not be able to recover them afterwards." 12 60
sel=$?
case $sel in
1) return;;
255) return;;
esac
clear
${PROJECT_NAME}-backup-local $drive remove
any_key
}
function shut_down_system {
dialog --title $"Power off the system" \
--backtitle $"Freedombone Control Panel" \
@ -833,7 +873,7 @@ function menu_backup_restore {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Backup and Restore" \
--radiolist $"Choose an operation:" 17 70 10 \
--radiolist $"Choose an operation:" 18 70 11 \
1 $"Backup data to USB drive" off \
2 $"Restore GPG key from USB keydrive" off \
3 $"Restore data from USB drive" off \
@ -843,7 +883,8 @@ function menu_backup_restore {
7 $"Backup GPG key to USB (master keydrive)" off \
8 $"Backup GPG key to USB (fragment keydrive)" off \
9 $"Format a USB drive (LUKS encrypted)" off \
10 $"Back to main menu" on 2> $data
10 $"Remove backups from a USB drive" off \
11 $"Back to main menu" on 2> $data
sel=$?
case $sel in
1) break;;
@ -859,7 +900,8 @@ function menu_backup_restore {
7) create_keydrive_master;;
8) create_keydrive_fragment;;
9) format_drive;;
10) break;;
10) remove_backups;;
11) break;;
esac
done
}