Shutdown and restart on control panel

This commit is contained in:
Bob Mottram 2015-11-21 20:01:53 +00:00
parent 63e4c2a06c
commit 89c1a4201b
2 changed files with 34 additions and 4 deletions

View File

@ -636,6 +636,32 @@ function format_drive {
any_key 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 { function menu_backup_restore {
while true while true
do do
@ -763,7 +789,7 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \ dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \ --title "Control Panel" \
--radiolist "Choose an operation:" 16 70 9 \ --radiolist "Choose an operation:" 18 70 11 \
1 "Backup and Restore" off \ 1 "Backup and Restore" off \
2 "Show SIP Phone Extensions" off \ 2 "Show SIP Phone Extensions" off \
3 "Reset Tripwire" off \ 3 "Reset Tripwire" off \
@ -772,7 +798,9 @@ function menu_top_level {
6 "Email Filtering Rules" off \ 6 "Email Filtering Rules" off \
7 "Security Settings" off \ 7 "Security Settings" off \
8 "Hubzilla" 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=$? sel=$?
case $sel in case $sel in
1) exit 1;; 1) exit 1;;
@ -787,7 +815,9 @@ function menu_top_level {
6) menu_email;; 6) menu_email;;
7) security_settings;; 7) security_settings;;
8) menu_hubzilla;; 8) menu_hubzilla;;
9) break;; 9) shut_down_system;;
10) restart_system;;
11) break;;
esac esac
done done
} }

View File

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