Browse Source

Control panel option to remove backups

Bob Mottram 9 years ago
parent
commit
3d1d6ef345
1 changed files with 45 additions and 3 deletions
  1. 45
    3
      src/freedombone-controlpanel

+ 45
- 3
src/freedombone-controlpanel View File

659
     any_key
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
 function shut_down_system {
702
 function shut_down_system {
663
     dialog --title $"Power off the system" \
703
     dialog --title $"Power off the system" \
664
            --backtitle $"Freedombone Control Panel" \
704
            --backtitle $"Freedombone Control Panel" \
833
         trap "rm -f $data" 0 1 2 5 15
873
         trap "rm -f $data" 0 1 2 5 15
834
         dialog --backtitle $"Freedombone Control Panel" \
874
         dialog --backtitle $"Freedombone Control Panel" \
835
                --title $"Backup and Restore" \
875
                --title $"Backup and Restore" \
836
-               --radiolist $"Choose an operation:" 17 70 10 \
876
+               --radiolist $"Choose an operation:" 18 70 11 \
837
                1 $"Backup data to USB drive" off \
877
                1 $"Backup data to USB drive" off \
838
                2 $"Restore GPG key from USB keydrive" off \
878
                2 $"Restore GPG key from USB keydrive" off \
839
                3 $"Restore data from USB drive" off \
879
                3 $"Restore data from USB drive" off \
843
                7 $"Backup GPG key to USB (master keydrive)" off \
883
                7 $"Backup GPG key to USB (master keydrive)" off \
844
                8 $"Backup GPG key to USB (fragment keydrive)" off \
884
                8 $"Backup GPG key to USB (fragment keydrive)" off \
845
                9 $"Format a USB drive (LUKS encrypted)" off \
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
         sel=$?
888
         sel=$?
848
         case $sel in
889
         case $sel in
849
             1) break;;
890
             1) break;;
859
             7) create_keydrive_master;;
900
             7) create_keydrive_master;;
860
             8) create_keydrive_fragment;;
901
             8) create_keydrive_fragment;;
861
             9) format_drive;;
902
             9) format_drive;;
862
-            10) break;;
903
+            10) remove_backups;;
904
+            11) break;;
863
         esac
905
         esac
864
     done
906
     done
865
 }
907
 }