- va=6.4.3
- vb=$va-060403
- vc=${vb}.202307110536
- pre="https://kernel.ubuntu.com/~kernel-ppa/mainline/v$va/amd64/linux-"
- if ! dpkg -s -- linux-headers-${vb} 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
- urls=(
- ${pre}headers-${vb}_${vc}_all.deb
- ${pre}{headers,image-unsigned,modules}-${vb}-generic_${vc}_amd64.deb
- )
+ ver='6\.6'
+ va=$(curl -s https://kernel.ubuntu.com/mainline/ | \
+ sed -rn 's,.*alt="\[DIR\]".*href="([^/]+).*,\1,p' | \
+ grep -v -- -rc | sed 's/^v//' | grep "^$ver" | sort -V | tail -n1)
+
+ # note the wiki page about these says to install linux-headers.*generic.*amd64, but
+ # as of 2024, they have a requirement of a very new glibc, and people report
+ # that installing it is not needed.
+ pkgs=$(curl -s https://kernel.ubuntu.com/mainline/v$va/amd64/CHECKSUMS | awk '$2 ~ /^linux-/ { print $2 }' | sort -u | grep -iv 'linux-headers.*generic.*amd64' )
+
+ urls=()
+ for p in $pkgs; do
+ if ! dpkg -s -- "${p%%_*}" 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
+ urls+=(https://kernel.ubuntu.com/mainline/v$va/amd64/$p)
+ fi
+ done
+ if (( ${#urls[@]} >= 1 )); then