Last active
September 16, 2023 19:12
-
-
Save LukeHuckman/635bff72f53f481697c0ba744399aa96 to your computer and use it in GitHub Desktop.
Linux kernel version checker script for Arch Linux using yay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
#Linux kernel version checker script for Arch Linux | |
# | |
kernelVariant=$(uname -r | rev | cut -d "-" -f 1 | rev) | |
versionDiff=$(diff <(uname -r | cut -d "-" -f 1 | cut -d "." -f 1,2,3) <(yay -Si linux$(if [ ! -z "$kernelVariant" ]; then echo "-$kernelVariant"; fi) | grep Version | cut -d ":" -f 2 | cut -d "-" -f 1 | cut -d "." -f 1,2,3 | awk '{print substr($0, 2)}') | tail -n +2) | |
if [ ! -z "$versionDiff" ]; then | |
echo -e "Variant:\n$(if [ -z "$kernelVariant" ]; then echo "stable"; else echo $kernelVariant; fi)\n$(sed '1i\Running:' <<<"$(sed -e 's/< //g;s/> //g;s/---/Latest:/g' <<<"$versionDiff")")" | |
else | |
echo -e "Variant:\n$(if [ -z "$kernelVariant" ]; then echo "stable"; else echo $kernelVariant; fi)\nVersion:\n$(uname -r | cut -d "-" -f 1 | cut -d "." -f 1,2,3) (Latest)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment