Reboot and powering off with progressbar

This commit is contained in:
Tobias Powalowski 2023-08-04 19:59:19 +02:00
parent acfaf4893c
commit f9d278d55d

View file

@ -77,18 +77,22 @@ _exit() {
_show_login
exit 0
elif [[ "${_EXIT}" == "2" ]]; then
_dialog --no-mouse --infobox "Rebooting in 10 seconds...\nDon't forget to remove the boot medium!" 4 50
sleep 10
clear
wall -n "Rebooting the system..."
sleep 3
while true; do
sleep 1
_COUNT=$((_COUNT+1))
# abort after 10 seconds
_progress "$((_COUNT*10))" "Rebooting in $((10-_COUNT)) seconds. Don't forget to remove the boot medium!"
[[ "${_COUNT}" == 10 ]] && break
done | _dialog --title " System " --no-mouse --gauge "Rebooting in 10 seconds. Don't forget to remove the boot medium!" 6 75 0
reboot
elif [[ "${_EXIT}" == "3" ]]; then
_dialog --no-mouse --infobox "Powering off in 10 seconds...\nDon't forget to remove the boot medium!" 4 50
sleep 10
clear
wall -n "Powering off the system..."
sleep 3
while true; do
sleep 1
_COUNT=$((_COUNT+1))
# abort after 10 seconds
_progress "$((_COUNT*10))" "Powering off in $((10-_COUNT)) seconds. Don't forget to remove the boot medium!"
[[ "${_COUNT}" == 10 ]] && break
done | _dialog --title " System " --no-mouse --gauge "Powering off in 10 seconds. Don't forget to remove the boot medium!" 6 75 0
poweroff
fi
}