From 89c1a4201b5ef15bdc6e2645e35d5c551484deb8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 21 Nov 2015 20:01:53 +0000 Subject: [PATCH] Shutdown and restart on control panel --- src/freedombone-controlpanel | 36 +++++++++++++++++++++++++++++++++--- src/freedombone-image | 2 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 47a41cbd..89ff7280 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -636,6 +636,32 @@ function format_drive { any_key } +function shut_down_system { + dialog --title "Power off the system" \ + --backtitle "Freedombone Control Panel" \ + --defaultno \ + --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 + sel=$? + case $sel in + 1) return;; + 255) return;; + esac + shutdown now +} + +function restart_system { + dialog --title "Restart the system" \ + --backtitle "Freedombone Control Panel" \ + --defaultno \ + --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 + sel=$? + case $sel in + 1) return;; + 255) return;; + esac + reboot +} + function menu_backup_restore { while true do @@ -763,7 +789,7 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Control Panel" \ --title "Control Panel" \ - --radiolist "Choose an operation:" 16 70 9 \ + --radiolist "Choose an operation:" 18 70 11 \ 1 "Backup and Restore" off \ 2 "Show SIP Phone Extensions" off \ 3 "Reset Tripwire" off \ @@ -772,7 +798,9 @@ function menu_top_level { 6 "Email Filtering Rules" off \ 7 "Security Settings" off \ 8 "Hubzilla" off \ - 9 "Exit" on 2> $data + 9 "Power off the system" off \ + 10 "Restart the system" off \ + 11 "Exit" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -787,7 +815,9 @@ function menu_top_level { 6) menu_email;; 7) security_settings;; 8) menu_hubzilla;; - 9) break;; + 9) shut_down_system;; + 10) restart_system;; + 11) break;; esac done } diff --git a/src/freedombone-image b/src/freedombone-image index 252c7066..dad21224 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -205,7 +205,7 @@ fi mv build/${PROJECT_NAME}*.bz2 ${CURR_DIR} mv build/${PROJECT_NAME}*.img ${CURR_DIR} mv build/${PROJECT_NAME}*.sig ${CURR_DIR} -rm -rf ${BUILD_DIR} +#rm -rf ${BUILD_DIR} clear echo "