瀏覽代碼

Backup menu style

Bob Mottram 7 年之前
父節點
當前提交
0c1e3938b0
共有 1 個文件被更改,包括 27 次插入26 次删除
  1. 27
    26
      src/freedombone-controlpanel

+ 27
- 26
src/freedombone-controlpanel 查看文件

@@ -1881,29 +1881,25 @@ function email_smtp_proxy {
1881 1881
 function menu_backup_restore {
1882 1882
     while true
1883 1883
     do
1884
-        data=$(mktemp 2>/dev/null)
1885
-        dialog --backtitle $"Freedombone Control Panel" \
1886
-               --title $"Backup and Restore" \
1887
-               --radiolist $"Choose an operation:" 19 70 12 \
1888
-               1 $"Backup data to USB drive" off \
1889
-               2 $"Restore GPG key from USB keydrive" off \
1890
-               3 $"Restore data from USB drive" off \
1891
-               4 $"Reinstall mariadb" off \
1892
-               5 $"Configure remote backups" off \
1893
-               6 $"Restore from remote backup" off \
1894
-               7 $"Backup GPG key to USB (master keydrive)" off \
1895
-               8 $"Backup GPG key to USB (fragment keydrive)" off \
1896
-               9 $"Format a USB drive (LUKS encrypted)" off \
1897
-               10 $"Remove backups from a USB drive" off \
1898
-               11 $"Back to main menu" on 2> "$data"
1899
-        sel=$?
1900
-        case $sel in
1901
-            1) rm -f "$data"
1902
-               break;;
1903
-            255) rm -f "$data"
1904
-                 break;;
1905
-        esac
1906
-        case $(cat "$data") in
1884
+        W=(1 $"Backup data to USB drive"
1885
+           2 $"Restore GPG key from USB keydrive"
1886
+           3 $"Restore data from USB drive"
1887
+           4 $"Reinstall mariadb"
1888
+           5 $"Configure remote backups"
1889
+           6 $"Restore from remote backup"
1890
+           7 $"Backup GPG key to USB (master keydrive)"
1891
+           8 $"Backup GPG key to USB (fragment keydrive)"
1892
+           9 $"Format a USB drive (LUKS encrypted)"
1893
+           10 $"Remove backups from a USB drive")
1894
+
1895
+        # shellcheck disable=SC2068
1896
+        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)
1897
+
1898
+        if [ ! "$selection" ]; then
1899
+           break
1900
+        fi
1901
+
1902
+        case $selection in
1907 1903
             1) backup_data;;
1908 1904
             2) restore_gpg_key;;
1909 1905
             3) restore_data;;
@@ -1914,10 +1910,7 @@ function menu_backup_restore {
1914 1910
             8) create_keydrive_fragment;;
1915 1911
             9) format_drive;;
1916 1912
             10) remove_backups;;
1917
-            11) rm -f "$data"
1918
-                break;;
1919 1913
         esac
1920
-        rm -f "$data"
1921 1914
     done
1922 1915
 }
1923 1916
 
@@ -1935,6 +1928,10 @@ function menu_email {
1935 1928
         # shellcheck disable=SC2068
1936 1929
         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)
1937 1930
 
1931
+        if [ ! "$selection" ]; then
1932
+           break
1933
+        fi
1934
+
1938 1935
         case $selection in
1939 1936
             1) add_to_mailing_list;;
1940 1937
             2) remove_user_from_mailing_list;;
@@ -2071,6 +2068,10 @@ function domain_blocking {
2071 2068
         # shellcheck disable=SC2068
2072 2069
         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)
2073 2070
 
2071
+        if [ ! "$selection" ]; then
2072
+           break
2073
+        fi
2074
+
2074 2075
         case $selection in
2075 2076
             1) domain_blocking_add;;
2076 2077
             2) domain_blocking_remove;;