diff options
-rw-r--r-- | check-kernel.in | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/check-kernel.in b/check-kernel.in index 6e6899c..823485f 100644 --- a/check-kernel.in +++ b/check-kernel.in @@ -157,15 +157,28 @@ else "${installed}" \ "${running}" if ${reboot}; then - if ! reboot_check_hook; then - >&2 printf 'reboot_check_hook() failed.\n' - exit 1 - fi - >&2 printf 'Press enter to reboot %s ...' \ - "$(hostname)" - read s - if [ -z "${s}" ]; then - PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin reboot + if command -v shutdownasap >/dev/null; then + >&2 printf 'Press enter to reboot %s ...' \ + "$(hostname)" + read s + if [ -z "${s}" ]; then + if command -v screen >/dev/null; then + shutdownasap -r + else + screen -d -m 'shutdownasap -r' + fi + fi + else + if ! reboot_check_hook; then + >&2 printf 'reboot_check_hook() failed.\n' + exit 1 + fi + >&2 printf 'Press enter to reboot %s ...' \ + "$(hostname)" + read s + if [ -z "${s}" ]; then + PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin reboot + fi fi else exit 1 |