Created
October 2, 2020 17:08
-
-
Save joestringer/e3c3f6e856a3dc5ad1d05b8847324c0f to your computer and use it in GitHub Desktop.
Fetch Ubuntu mainline debs for a specific kernel version
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
#!/usr/bin/env bash | |
set -eu | |
VERSION="${1:-}" | |
ERSION="$(echo $VERSION | sed 's/[^0-9]*\([0-9rc.-]\+\)/\1/')" | |
URL="https://kernel.ubuntu.com/~kernel-ppa/mainline/v$ERSION" | |
CURL_OPTS=${CURL_OPTS:-""} | |
if [[ $# -ne 1 ]]; then | |
echo "usage: $0 <kernel-version>" 1>&2 | |
echo 1>&2 | |
echo "Fetch the deb pkgs for mainline kernels from:" 1>&2 | |
echo "$URL" 1>&2 | |
exit 1 | |
fi | |
DEBS=($(curl -s "$URL/" \ | |
| grep "\(amd64\|all\).deb" \ | |
| sed 's/.*[">]\([^">]*\(amd64\|all\).deb\).*/\1/g' \ | |
| sort \ | |
| uniq \ | |
| grep -v lowlatency \ | |
| sed 's,\(.*\),'$URL/'\1,g')) | |
if [ ${#DEBS[@]} -eq 0 ]; then | |
echo "Invalid version v$ERSION. Is this version available? Check here:" 2>&1 | |
echo "$URL" 2>&1 | |
exit 1 | |
fi | |
curl $CURL_OPTS $(for pkg in ${DEBS[@]}; do echo "-O $pkg"; done) | |
echo "Downloaded mainline Linux debs for v$ERSION:" | |
ls *$ERSION*deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment