From 0c1e3938b0e4fa27f269dc1512e51161d9300bab Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 17 Mar 2018 21:58:29 +0000 Subject: [PATCH] Backup menu style --- src/freedombone-controlpanel | 53 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 77528e8f..8b54d0e5 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -1881,29 +1881,25 @@ function email_smtp_proxy { function menu_backup_restore { while true do - data=$(mktemp 2>/dev/null) - dialog --backtitle $"Freedombone Control Panel" \ - --title $"Backup and Restore" \ - --radiolist $"Choose an operation:" 19 70 12 \ - 1 $"Backup data to USB drive" off \ - 2 $"Restore GPG key from USB keydrive" off \ - 3 $"Restore data from USB drive" off \ - 4 $"Reinstall mariadb" off \ - 5 $"Configure remote backups" off \ - 6 $"Restore from remote backup" off \ - 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 $"Remove backups from a USB drive" off \ - 11 $"Back to main menu" on 2> "$data" - sel=$? - case $sel in - 1) rm -f "$data" - break;; - 255) rm -f "$data" - break;; - esac - case $(cat "$data") in + W=(1 $"Backup data to USB drive" + 2 $"Restore GPG key from USB keydrive" + 3 $"Restore data from USB drive" + 4 $"Reinstall mariadb" + 5 $"Configure remote backups" + 6 $"Restore from remote backup" + 7 $"Backup GPG key to USB (master keydrive)" + 8 $"Backup GPG key to USB (fragment keydrive)" + 9 $"Format a USB drive (LUKS encrypted)" + 10 $"Remove backups from a USB drive") + + # shellcheck disable=SC2068 + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Backup and Restore" --menu $"Choose an operation, or ESC for main menu:" 19 70 12 "${W[@]}" 3>&2 2>&1 1>&3) + + if [ ! "$selection" ]; then + break + fi + + case $selection in 1) backup_data;; 2) restore_gpg_key;; 3) restore_data;; @@ -1914,10 +1910,7 @@ function menu_backup_restore { 8) create_keydrive_fragment;; 9) format_drive;; 10) remove_backups;; - 11) rm -f "$data" - break;; esac - rm -f "$data" done } @@ -1935,6 +1928,10 @@ function menu_email { # shellcheck disable=SC2068 selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Email Menu" --menu $"Choose an operation, or ESC for main menu:" 15 70 8 "${W[@]}" 3>&2 2>&1 1>&3) + if [ ! "$selection" ]; then + break + fi + case $selection in 1) add_to_mailing_list;; 2) remove_user_from_mailing_list;; @@ -2071,6 +2068,10 @@ function domain_blocking { # shellcheck disable=SC2068 selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Domain or User Blocking" --menu $"Choose an operation, or ESC for main menu:" 13 70 6 "${W[@]}" 3>&2 2>&1 1>&3) + if [ ! "$selection" ]; then + break + fi + case $selection in 1) domain_blocking_add;; 2) domain_blocking_remove;;