Skip to content

Instantly share code, notes, and snippets.

@kunev
Created October 9, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunev/616d258f25cb0f4c55bac1678099204d to your computer and use it in GitHub Desktop.
Save kunev/616d258f25cb0f4c55bac1678099204d to your computer and use it in GitHub Desktop.
check if currently running kernel version matches the installed linux package version
#!/bin/bash
function currently_installed_kernel() {
yaourt -Qi linux | egrep '^Version\s+:\s+.+$' | sed -e 's/Version\s\+:\s\+//'
}
function currently_running_kernel() {
uname -a | grep -P '\S+(?=-ARCH)' -o
}
installed=$(currently_installed_kernel)
running=$(currently_running_kernel)
if [ "$running" == "$installed" ]; then
echo "Running kernel version matches installed linux package version"
exit 0
else
echo "Running kernel version differs from installed linux package version"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment