diff options
-rw-r--r-- | check-kernel.in | 18 |
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 |