summaryrefslogtreecommitdiff
path: root/check-kernel.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-01-08 20:07:13 +0100
committerErich Eckner <git@eckner.net>2018-01-08 20:07:13 +0100
commit280e7235bcf4cbd584c7861289321b67f39fb817 (patch)
tree54e4034dc3838b670a9828aa51965cc79d3942ef /check-kernel.in
parent35f3272920e1bd31304fa29cf47d5352bfbc6142 (diff)
downloadcheck-kernel-280e7235bcf4cbd584c7861289321b67f39fb817.tar.xz
check-kernel.in: generic kernel detection added
Diffstat (limited to 'check-kernel.in')
-rw-r--r--check-kernel.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/check-kernel.in b/check-kernel.in
index b3088d7..4b9f421 100644
--- a/check-kernel.in
+++ b/check-kernel.in
@@ -46,6 +46,7 @@ while true; do
shift
done
+unset installed
if which pacman >/dev/null 2>&1; then
# arch linux
running=$(
@@ -74,6 +75,23 @@ elif which apt >/dev/null 2>&1; then
tail -n1
)
else
+ running=$(
+ uname -r
+ )
+ installed=$(
+ ls /boot | \
+ sed -n '
+ s/^vmlinuz-\([0-9.]\+\)$/\1/
+ T
+ p
+ ' | \
+ sort -V | \
+ tail -n1
+ )
+fi
+
+if [ -z "${installed}" ] || \
+ [ "$(echo "${installed}" | wc -l)" -ne 1 ]; then
>&2 printf 'Cannot determin installed kernel.\n'
exit 2
fi