Ver código fonte

Control panel option to remove backups

Bob Mottram 9 anos atrás
pai
commit
3d1d6ef345
1 arquivos alterados com 45 adições e 3 exclusões
  1. 45
    3
      src/freedombone-controlpanel

+ 45
- 3
src/freedombone-controlpanel Ver arquivo

@@ -659,6 +659,46 @@ function format_drive {
659 659
     any_key
660 660
 }
661 661
 
662
+function remove_backups {
663
+    drive=
664
+    data=$(tempfile 2>/dev/null)
665
+    trap "rm -f $data" 0 1 2 5 15
666
+    dialog --backtitle $"Freedombone Control Panel" \
667
+           --title $"Remove backups from a USB drive" \
668
+           --radiolist $"Choose a drive:" 12 70 5 \
669
+           1 $"sda (Beaglebone Black)" off \
670
+           2 $"sdb" off \
671
+           3 $"sdc" off \
672
+           4 $"sdd" off \
673
+           5 $"Back to Backup and Restore menu" on 2> $data
674
+    sel=$?
675
+    case $sel in
676
+        1) return;;
677
+        255) return;;
678
+    esac
679
+    case $(cat $data) in
680
+        1) drive='sda';;
681
+        2) drive='sdb';;
682
+        3) drive='sdc';;
683
+        4) drive='sdd';;
684
+        5) return;;
685
+    esac
686
+
687
+    dialog --title $"Remove backups from a USB drive" \
688
+           --backtitle $"Freedombone Control Panel" \
689
+           --defaultno \
690
+           --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
691
+    sel=$?
692
+    case $sel in
693
+        1) return;;
694
+        255) return;;
695
+    esac
696
+
697
+    clear
698
+    ${PROJECT_NAME}-backup-local $drive remove
699
+    any_key
700
+}
701
+
662 702
 function shut_down_system {
663 703
     dialog --title $"Power off the system" \
664 704
            --backtitle $"Freedombone Control Panel" \
@@ -833,7 +873,7 @@ function menu_backup_restore {
833 873
         trap "rm -f $data" 0 1 2 5 15
834 874
         dialog --backtitle $"Freedombone Control Panel" \
835 875
                --title $"Backup and Restore" \
836
-               --radiolist $"Choose an operation:" 17 70 10 \
876
+               --radiolist $"Choose an operation:" 18 70 11 \
837 877
                1 $"Backup data to USB drive" off \
838 878
                2 $"Restore GPG key from USB keydrive" off \
839 879
                3 $"Restore data from USB drive" off \
@@ -843,7 +883,8 @@ function menu_backup_restore {
843 883
                7 $"Backup GPG key to USB (master keydrive)" off \
844 884
                8 $"Backup GPG key to USB (fragment keydrive)" off \
845 885
                9 $"Format a USB drive (LUKS encrypted)" off \
846
-               10 $"Back to main menu" on 2> $data
886
+               10 $"Remove backups from a USB drive" off \
887
+               11 $"Back to main menu" on 2> $data
847 888
         sel=$?
848 889
         case $sel in
849 890
             1) break;;
@@ -859,7 +900,8 @@ function menu_backup_restore {
859 900
             7) create_keydrive_master;;
860 901
             8) create_keydrive_fragment;;
861 902
             9) format_drive;;
862
-            10) break;;
903
+            10) remove_backups;;
904
+            11) break;;
863 905
         esac
864 906
     done
865 907
 }