Created
July 19, 2020 12:28
-
-
Save fornellas/615e2bbfd141e94af5273144fecb7c3d to your computer and use it in GitHub Desktop.
Update Ubuntu to Latest Vanilla Kernel
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/bash -e | |
LATEST_VERSION="$( | |
wget -qO- 'https://kernel.ubuntu.com/~kernel-ppa/mainline/' \ | |
| grep -E 'href="v[0-9.]+/"' \ | |
| cut -d \" -f8 \ | |
| cut -c2- \ | |
| cut -d/ -f1| sort --version-sort \ | |
| tail -n 1 | |
)" | |
UNAME_VERSION="$(uname -r)" | |
CANDIDATE_VERSION="$( | |
( echo "$UNAME_VERSION" ; echo "$LATEST_VERSION" ) \ | |
| sort --version-sort \ | |
| tail -n 1 | |
)" | |
if [ "$CANDIDATE_VERSION" == "$UNAME_VERSION" ] | |
then | |
echo "Already running latest." | |
exit 0 | |
fi | |
echo "Upgrade available: $LATEST_VERSION" | |
DEBS_PATH="$(dirname $0)/debs" | |
rm -f "$DEBS_PATH"/*.deb | |
DEB_NAMES=( | |
$( | |
wget -qO- https://kernel.ubuntu.com/~kernel-ppa/mainline/v"$LATEST_VERSION"/amd64/ \ | |
| grep -E 'linux-.*\.deb' \ | |
| grep -v lowlatency \ | |
| cut -d\" -f 8 | |
) | |
) | |
echo Downloading: | |
for DEB in "${DEB_NAMES[@]}" | |
do | |
echo " $DEB..." | |
wget \ | |
-q \ | |
-O"$DEBS_PATH"/"$DEB" \ | |
https://kernel.ubuntu.com/~kernel-ppa/mainline/v"$LATEST_VERSION"/amd64/"$DEB" | |
done | |
echo Installing: | |
sudo dpkg -i "$DEBS_PATH"/*.deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment