Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Last active June 16, 2017 15:20
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 renaudcerrato/d1d3dc2e7f49d86a808ff020a7b0eb88 to your computer and use it in GitHub Desktop.
Save renaudcerrato/d1d3dc2e7f49d86a808ff020a7b0eb88 to your computer and use it in GitHub Desktop.
Easily install Ubuntu linux kernels.
#!/bin/bash
set -e
BASEURL=http://kernel.ubuntu.com/~kernel-ppa/mainline
BUILDIR=${BUILDIR:-$HOME/.build}
ARCH=$(dpkg --print-architecture)
VERSIONS=$(curl -s $BASEURL/ | sed -n 's/.*href="v\([^/"]*\).*/\1/p' | grep -v rc | sort -t. -k 1,1rn -k 2,2rn -k 3,3rn | head -n 100)
MENU=()
for VERSION in $VERSIONS; do
MENU+=($VERSION $VERSION)
done
VERSION=$(whiptail --notags --title $(uname -r) --menu "Kernel version?" 18 60 10 "${MENU[@]}" 3>&1 1>&2 2>&3)
ARCHIVES=$(curl -s $BASEURL/v${VERSION}/ | sed -n 's/.*href="\([^"]*\.deb\).*/\1/p' | grep -e "all\|$ARCH" | grep -v lowlatency | sort -u)
mkdir -p $BUILDIR
for deb in $ARCHIVES; do
[ -f $BUILDIR/$deb ] || wget -P $BUILDIR $BASEURL/v${VERSION}/$deb
sudo dpkg -i $BUILDIR/$deb
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment