mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-28 04:26:28 +02:00
confirmation for reboot and shutdown
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Starting the main menu ..."
|
echo "Starting the main menu ..."
|
||||||
|
|
||||||
# CONFIGFILE - configuration of RaspiBlitz
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
@@ -7,9 +8,13 @@ configFile="/mnt/hdd/raspiblitz.conf"
|
|||||||
# INFOFILE - state data from bootstrap
|
# INFOFILE - state data from bootstrap
|
||||||
infoFile="/home/admin/raspiblitz.info"
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
|
||||||
|
# CONFIRMATIONFILE - confirmation dialog
|
||||||
|
confirmationFile="/home/admin/XXconfirmation.sh"
|
||||||
|
|
||||||
# MAIN MENU AFTER SETUP
|
# MAIN MENU AFTER SETUP
|
||||||
source ${infoFile}
|
source ${infoFile}
|
||||||
source ${configFile}
|
source ${configFile}
|
||||||
|
source ${confirmationFile}
|
||||||
|
|
||||||
# get the local network IP to be displayed on the lCD
|
# 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'/')
|
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
|
/home/admin/99updateMenu.sh
|
||||||
;;
|
;;
|
||||||
REBOOT)
|
REBOOT)
|
||||||
clear
|
clear
|
||||||
echo ""
|
confirmation "Reboot" true 9 40
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
confirmationReboot=$?
|
||||||
exit 0
|
if [ $confirmationReboot -eq 0 ]; then
|
||||||
|
clear
|
||||||
|
echo ""
|
||||||
|
sudo /home/admin/XXshutdown.sh reboot
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
OFF)
|
OFF)
|
||||||
clear
|
clear
|
||||||
echo ""
|
confirmation "PowerOff" true 9 40
|
||||||
sudo /home/admin/XXshutdown.sh
|
confirmationShutdown=$?
|
||||||
exit 0
|
if [ $confirmationShutdown -eq 0 ]; then
|
||||||
|
clear
|
||||||
|
echo ""
|
||||||
|
sudo /home/admin/XXshutdown.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
DELETE)
|
DELETE)
|
||||||
sudo /home/admin/XXcleanHDD.sh
|
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