diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index a652ad5d..e48de25c 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -549,6 +549,47 @@ function hubzilla_channel_directory_server { esac } +function format_drive { + drive= + + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 + dialog --backtitle "Freedombone Control Panel" \ + --title "Format a USB drive" \ + --radiolist "Choose a drive:" 14 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 "Format USB drive" \ + --backtitle "Freedombone Control Panel" \ + --defaultno \ + --yesno "\nPlease confirm that you wish to format drive\n\n${drive}\n\n. All current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nIf you screw up here and format the wrong drive it's your own fault!" 10 60 + sel=$? + case $sel in + 1) return;; + 255) return;; + esac + + clear + freedombone-format $drive + any_key +} + function menu_backup_restore { while true do @@ -556,7 +597,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:" 15 70 8 \ + --radiolist "Choose an operation:" 16 70 9 \ 1 "Backup data to USB drive" off \ 2 "Restore GPG key from USB keydrive" off \ 3 "Restore data from USB drive" off \ @@ -564,7 +605,8 @@ function menu_backup_restore { 5 "Restore from remote backup" off \ 6 "Backup GPG key to USB (master keydrive)" off \ 7 "Backup GPG key to USB (fragment keydrive)" off \ - 8 "Back to main menu" on 2> $data + 8 "Format a USB drive" off \ + 9 "Back to main menu" on 2> $data sel=$? case $sel in 1) break;; @@ -578,7 +620,8 @@ function menu_backup_restore { 5) restore_data_remote;; 6) create_keydrive_master;; 7) create_keydrive_fragment;; - 8) break;; + 7) format_drive;; + 9) break;; esac done }