Browse Source

Shutdown and restart on control panel

Bob Mottram 9 years ago
parent
commit
89c1a4201b
2 changed files with 34 additions and 4 deletions
  1. 33
    3
      src/freedombone-controlpanel
  2. 1
    1
      src/freedombone-image

+ 33
- 3
src/freedombone-controlpanel View File

@@ -636,6 +636,32 @@ function format_drive {
636 636
     any_key
637 637
 }
638 638
 
639
+function shut_down_system {
640
+    dialog --title "Power off the system" \
641
+           --backtitle "Freedombone Control Panel" \
642
+           --defaultno \
643
+           --yesno "\nPlease confirm that you wish to power off the system.\n\nWARNING: to power on again you will need to have physical access to the hardware." 10 60
644
+    sel=$?
645
+    case $sel in
646
+        1) return;;
647
+        255) return;;
648
+    esac
649
+    shutdown now
650
+}
651
+
652
+function restart_system {
653
+    dialog --title "Restart the system" \
654
+           --backtitle "Freedombone Control Panel" \
655
+           --defaultno \
656
+           --yesno "\nPlease confirm that you wish to restart the system.\n\nWARNING: If you are using full disk encryption then you will need physical access to the hardware to type in the password" 10 60
657
+    sel=$?
658
+    case $sel in
659
+        1) return;;
660
+        255) return;;
661
+    esac
662
+    reboot
663
+}
664
+
639 665
 function menu_backup_restore {
640 666
     while true
641 667
     do
@@ -763,7 +789,7 @@ function menu_top_level {
763 789
         trap "rm -f $data" 0 1 2 5 15
764 790
         dialog --backtitle "Freedombone Control Panel" \
765 791
                --title "Control Panel" \
766
-               --radiolist "Choose an operation:" 16 70 9 \
792
+               --radiolist "Choose an operation:" 18 70 11 \
767 793
                1 "Backup and Restore" off \
768 794
                2 "Show SIP Phone Extensions" off \
769 795
                3 "Reset Tripwire" off \
@@ -772,7 +798,9 @@ function menu_top_level {
772 798
                6 "Email Filtering Rules" off \
773 799
                7 "Security Settings" off \
774 800
                8 "Hubzilla" off \
775
-               9 "Exit" on 2> $data
801
+               9 "Power off the system" off \
802
+               10 "Restart the system" off \
803
+               11 "Exit" on 2> $data
776 804
         sel=$?
777 805
         case $sel in
778 806
             1) exit 1;;
@@ -787,7 +815,9 @@ function menu_top_level {
787 815
             6) menu_email;;
788 816
             7) security_settings;;
789 817
             8) menu_hubzilla;;
790
-            9) break;;
818
+            9) shut_down_system;;
819
+            10) restart_system;;
820
+            11) break;;
791 821
         esac
792 822
     done
793 823
 }

+ 1
- 1
src/freedombone-image View File

@@ -205,7 +205,7 @@ fi
205 205
 mv build/${PROJECT_NAME}*.bz2 ${CURR_DIR}
206 206
 mv build/${PROJECT_NAME}*.img ${CURR_DIR}
207 207
 mv build/${PROJECT_NAME}*.sig ${CURR_DIR}
208
-rm -rf ${BUILD_DIR}
208
+#rm -rf ${BUILD_DIR}
209 209
 
210 210
 clear
211 211
 echo "