arno
2020-07-19 23:45:23 +02:00
committed by GitHub
parent aa486e3f05
commit a2a2d91eeb
2 changed files with 12 additions and 10 deletions

View File

@@ -285,7 +285,7 @@ case $CHOICE in
;;
REBOOT)
clear
confirmation "Reboot" true 9 40
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
confirmationReboot=$?
if [ $confirmationReboot -eq 0 ]; then
clear
@@ -296,7 +296,7 @@ case $CHOICE in
;;
OFF)
clear
confirmation "PowerOff" true 9 40
confirmation "Are you sure?" "PowerOff" "Cancel" true 7 40
confirmationShutdown=$?
if [ $confirmationShutdown -eq 0 ]; then
clear

View File

@@ -3,20 +3,22 @@
confirmation()
{
local text=$1
local defaultno=$2
local height=$3
local width=$4
local yesButtonText=$2
local noButtonText=$3
local defaultno=$4
local height=$5
local width=$6
local answer=-100
if [ $defaultno ]; then
whiptail --title " Confirmation " --defaultno --yes-button "Yes" --no-button "No" --yesno " $1
whiptail --title " Confirmation " --defaultno --yes-button "$yesButtonText" --no-button "$noButtonText" --yesno " $text
Are you sure?
" $height $width
else
whiptail --title " Confirmation " --yes-button "Yes" --no-button "No" --yesno " $1
whiptail --title " Confirmation " --yes-button "$yesButtonText" --no-button "$noButtonText" --yesno " $text
Are you sure?
" $height $width
fi
return $?
answer=$?
return $answer
}