Add posibility to just poweroff the host
This commit is contained in:
parent
ecab3bea7e
commit
70bdbc8a89
8
winboot
8
winboot
|
@ -15,6 +15,7 @@ readonly WIN_GRUB="2"
|
||||||
|
|
||||||
## By default, the host should reboot at the end of the script
|
## By default, the host should reboot at the end of the script
|
||||||
REBOOT=0
|
REBOOT=0
|
||||||
|
HALT=1
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ main() { # {{{
|
||||||
printf '%b' "Reboot to windaube partition\\n"
|
printf '%b' "Reboot to windaube partition\\n"
|
||||||
sudo grub-reboot "${WIN_GRUB}"
|
sudo grub-reboot "${WIN_GRUB}"
|
||||||
[ "${REBOOT}" -eq "0" ] && sudo systemctl reboot
|
[ "${REBOOT}" -eq "0" ] && sudo systemctl reboot
|
||||||
|
[ "${HALT}" -eq "0" ] && sudo systemctl poweroff
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Otherwise check the default grub file
|
# Otherwise check the default grub file
|
||||||
|
@ -34,6 +36,7 @@ main() { # {{{
|
||||||
printf '%b' "Reboot to windaube partition\\n"
|
printf '%b' "Reboot to windaube partition\\n"
|
||||||
sudo grub-reboot "${WIN_GRUB}"
|
sudo grub-reboot "${WIN_GRUB}"
|
||||||
[ "${REBOOT}" -eq "0" ] && sudo systemctl reboot
|
[ "${REBOOT}" -eq "0" ] && sudo systemctl reboot
|
||||||
|
[ "${HALT}" -eq "0" ] && sudo systemctl poweroff
|
||||||
else
|
else
|
||||||
|
|
||||||
printf '%b' "GRUB_DEFAULT is not set in 'saved' mode\\n"
|
printf '%b' "GRUB_DEFAULT is not set in 'saved' mode\\n"
|
||||||
|
@ -59,6 +62,11 @@ if [ ! "${NBARGS}" -eq "0" ]; then
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
--reboot ) ## A reboot was requested (default behaviour)
|
--reboot ) ## A reboot was requested (default behaviour)
|
||||||
REBOOT=0
|
REBOOT=0
|
||||||
|
HALT=1
|
||||||
|
;;
|
||||||
|
--halt|--poweroff ) ## A poweroff was requested
|
||||||
|
REBOOT=1
|
||||||
|
HALT=0
|
||||||
;;
|
;;
|
||||||
-- ) ## End of options list
|
-- ) ## End of options list
|
||||||
## End the while loop
|
## End the while loop
|
||||||
|
|
Loading…
Reference in New Issue