Last active
April 6, 2023 19:59
-
-
Save meffie/b4fc50d306922da4b78accb013b5e7fc to your computer and use it in GitHub Desktop.
Shell script to download mainline kernel ppa packages published by the Ubuntu kernel team.
This file contains hidden or 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 | |
# | |
# Download mainline kernel ppa packages published by the Ubuntu kernel team. | |
# | |
# usage: kernel-ppa list | |
# kernel-ppa get [<version>] | |
# kernel-ppa install | |
# | |
# | |
BASEURL="http://kernel.ubuntu.com/~kernel-ppa/mainline" | |
usage() { | |
echo "usage: kernel-ppa list" | |
echo " kernel-ppa get [<version>]" | |
echo " kernel-ppa install" | |
} | |
list_versions() { | |
wget -q -O - "$BASEURL/?C=N;O=D" | | |
perl -lane 'print $1 if /href="([^"]+)"/' | | |
sed 's@/$@@' | |
} | |
get_packages() { | |
version="$1" | |
arch=`uname -m | sed s/x86_64/amd64/` | |
if [ "x$version" = "x" ]; then | |
version=`list_versions | head -1` | |
fi | |
wget \ | |
--no-verbose \ | |
--recursive \ | |
--execute robots=off \ | |
--no-parent \ | |
--no-directories \ | |
--no-clobber \ | |
--accept "*_all.deb,*_${arch}.deb" \ | |
--reject "*lowlatency*.deb" \ | |
"${BASEURL}/${version}/" | |
} | |
install_packages() { | |
sudo -n DEBIAN_FRONTEND=noninteractive dpkg --install linux-*.deb | |
} | |
case "$1" in | |
help) usage ;; | |
list) list_versions ;; | |
get) get_packages "$2" ;; | |
install) install_packages ;; | |
*) | |
usage | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment