mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
add shutdown and reboot routine from launcher
This commit is contained in:
parent
3aac353003
commit
edaf41f8a1
2 changed files with 47 additions and 10 deletions
|
@ -275,18 +275,22 @@ _mainmenu() {
|
|||
fi
|
||||
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 Reboot " --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 Shutdown " --no-mouse --gauge "Powering off in 10 seconds. Don't forget to remove the boot medium!" 6 75 0
|
||||
poweroff
|
||||
fi
|
||||
;;
|
||||
|
|
|
@ -27,6 +27,39 @@ fi
|
|||
_PACMAN="pacman --root ${_DESTDIR} --cachedir=${_DESTDIR}/var/cache/pacman/pkg --noconfirm --noprogressbar"
|
||||
_MIRRORLIST="/etc/pacman.d/mirrorlist"
|
||||
|
||||
# $1: percentage
|
||||
# $2: message
|
||||
_progress() {
|
||||
cat <<EOF
|
||||
XXX
|
||||
${1}
|
||||
${2}
|
||||
XXX
|
||||
EOF
|
||||
}
|
||||
|
||||
# $1: start percentage
|
||||
# $2: end percentage
|
||||
# $3: message
|
||||
# $4: sleep time
|
||||
_progress_wait() {
|
||||
_COUNT=${1}
|
||||
while [[ -e "${_W_DIR}/.archboot" || -e /.archboot ]]; do
|
||||
if [[ "${_COUNT}" -lt "${2}" ]]; then
|
||||
_progress "${_COUNT}" "${3}"
|
||||
fi
|
||||
if [[ "${_COUNT}" -gt "${2}" ]]; then
|
||||
_progress "${2}" "${3}"
|
||||
fi
|
||||
# abort after 15 minutes
|
||||
if [[ "${_COUNT}" -gt 150 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
_COUNT="$((_COUNT+1))"
|
||||
sleep "${4}"
|
||||
done
|
||||
}
|
||||
|
||||
_linux_firmware() {
|
||||
_PACKAGES="${_PACKAGES//\ linux-firmware\ / }"
|
||||
#shellcheck disable=SC2013
|
||||
|
|
Loading…
Reference in a new issue