summaryrefslogtreecommitdiff
path: root/check-kernel.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-01-08 09:35:21 +0100
committerErich Eckner <git@eckner.net>2018-01-08 09:35:21 +0100
commit94b2c7e4e9ab91f3e7794fb142ff27207c3fff6c (patch)
treebfce1e61f94402af41f4412862d763dd3adcc220 /check-kernel.in
parentfe5e1099ae5b010ee16e050198db041da50f35da (diff)
downloadcheck-kernel-94b2c7e4e9ab91f3e7794fb142ff27207c3fff6c.tar.xz
check-kernel.in: kann jetzt auch rebooten
Diffstat (limited to 'check-kernel.in')
-rw-r--r--check-kernel.in20
1 files 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