From 94b2c7e4e9ab91f3e7794fb142ff27207c3fff6c Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 8 Jan 2018 09:35:21 +0100 Subject: check-kernel.in: kann jetzt auch rebooten --- check-kernel.in | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/check-kernel.in b/check-kernel.in index 2354345..1113b75 100644 --- a/check-kernel.in +++ b/check-kernel.in @@ -47,7 +47,6 @@ while true; do shift done - if which pacman >/dev/null 2>&1; then # arch linux running=$( @@ -66,11 +65,12 @@ elif which apt >/dev/null 2>&1; then uname -r ) installed=$( - dpkg-query -W 'linux-image-*-?86' | \ + dpkg-query -W 'linux-image-*' | \ cut -f1 | \ sed ' s|^linux-image-|| ' | \ + grep -x '\([0-9.]\+-\)\{2\}[^-]\+' | \ sort -V | \ tail -n1 ) @@ -80,12 +80,22 @@ else fi if [ "${running}" = "${installed}" ]; then - >&2 printf 'The installed kernel (%s) is currently running.\n' \ - "${installed}" + if ! ${reboot}; then + >&2 printf 'The installed kernel (%s) is currently running.\n' \ + "${installed}" + fi exit 0 else >&2 printf 'The installed (%s) and running kernel (%s) differ.\n' \ "${installed}" \ "${running}" - exit 1 + if ${reboot}; then + >&2 printf 'Press enter to reboot ...' + read s + if [ -z "${s}" ]; then + reboot + fi + else + exit 1 + fi fi -- cgit v1.2.3-70-g09d2