From 67443d378c3e9d25e8da351324e8bb5f6695e625 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 27 Apr 2020 14:14:18 +0200 Subject: check-kernel: use shutdownasap instead of reboot - if available --- check-kernel.in | 31 ++++++++++++++++++++++--------- 1 file 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 -- cgit v1.2.3-70-g09d2