mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-26 19:47:05 +02:00
confirmation for reboot and shutdown
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Starting the main menu ..."
|
||||
|
||||
# CONFIGFILE - configuration of RaspiBlitz
|
||||
@@ -7,9 +8,13 @@ configFile="/mnt/hdd/raspiblitz.conf"
|
||||
# INFOFILE - state data from bootstrap
|
||||
infoFile="/home/admin/raspiblitz.info"
|
||||
|
||||
# CONFIRMATIONFILE - confirmation dialog
|
||||
confirmationFile="/home/admin/XXconfirmation.sh"
|
||||
|
||||
# MAIN MENU AFTER SETUP
|
||||
source ${infoFile}
|
||||
source ${configFile}
|
||||
source ${confirmationFile}
|
||||
|
||||
# get the local network IP to be displayed on the lCD
|
||||
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
@@ -279,16 +284,26 @@ case $CHOICE in
|
||||
/home/admin/99updateMenu.sh
|
||||
;;
|
||||
REBOOT)
|
||||
clear
|
||||
echo ""
|
||||
sudo /home/admin/XXshutdown.sh reboot
|
||||
exit 0
|
||||
clear
|
||||
confirmation "Reboot" true 9 40
|
||||
confirmationReboot=$?
|
||||
if [ $confirmationReboot -eq 0 ]; then
|
||||
clear
|
||||
echo ""
|
||||
sudo /home/admin/XXshutdown.sh reboot
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
OFF)
|
||||
clear
|
||||
echo ""
|
||||
sudo /home/admin/XXshutdown.sh
|
||||
exit 0
|
||||
clear
|
||||
confirmation "PowerOff" true 9 40
|
||||
confirmationShutdown=$?
|
||||
if [ $confirmationShutdown -eq 0 ]; then
|
||||
clear
|
||||
echo ""
|
||||
sudo /home/admin/XXshutdown.sh
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
DELETE)
|
||||
sudo /home/admin/XXcleanHDD.sh
|
||||
|
22
home.admin/XXconfirmation.sh
Executable file
22
home.admin/XXconfirmation.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
confirmation()
|
||||
{
|
||||
text=$1
|
||||
defaultno=$2
|
||||
height=$3
|
||||
width=$4
|
||||
|
||||
if [ $defaultno ]; then
|
||||
whiptail --title " Confirmation " --defaultno --yes-button "Yes" --no-button "No" --yesno " $1
|
||||
|
||||
Are you sure?
|
||||
" $height $width
|
||||
else
|
||||
whiptail --title " Confirmation " --yes-button "Yes" --no-button "No" --yesno " $1
|
||||
|
||||
Are you sure?
|
||||
" $height $width
|
||||
fi
|
||||
return $?
|
||||
}
|
Reference in New Issue
Block a user