further bookworm support
[automated-distro-installer] / fai / config / scripts / IANK / 11-iank
index 1aa974057798a449b7ae9c08c85fffeb0b645c70..63c85f96e992452999a349210252fd05af96595a 100755 (executable)
@@ -1,4 +1,20 @@
 #!/bin/bash -x
+# This file is part of Ian Kelling's automated-distro-installer
+# Copyright (C) 2024 Ian Kelling
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
@@ -208,39 +224,9 @@ EOF
 
 fi
 
-# for new btrfs features, get latest stable kernel and btrfs progs,
-# update ver= as needed.
 case $HOSTNAME in
   sy)
-    mkdir -p $FAI_ROOT/tmp/kernel-debs
-    files=($FAI_ROOT/tmp/kernel-debs/*)
-    if (( ${#files[@]} >= 1 )); then
-      rm -rf "${files[@]}"
-    fi
-    cd $FAI_ROOT/tmp/kernel-debs
-    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
-      wget "${urls[@]}"
-      $chroot bash <<EOF
-cd /tmp/kernel-debs
-dpkg -i *.deb
-EOF
-    fi
+    $FAI/distro-install-common/install-stable-kernel-debs
     ;;
   *)
     $chroot apt-get -y install linux-libre
@@ -249,13 +235,13 @@ esac
 
 pre=https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
 tarball=$(curl -s $pre/sha256sums.asc \
-            | awk '$2 ~ /^btrfs-progs-v/ { print $2 }' | grep -v -- -rc | grep "^btrfs-progs-v${ver}.*gz\$" | sort -V | tail -n1)
+            | awk '$2 ~ /^btrfs-progs-v/ { print $2 }' | grep -v -- -rc | grep "^btrfs-progs-v.*gz\$" | sort -V | tail -n1)
 url="$pre/$tarball"
 dir=${tarball%.tar.gz}
-ver=${dir#btrfs-progs}
+ver=${dir#btrfs-progs-}
 cur_ver=$(btrfs --version 2>/dev/null | awk '{print $2}') ||:
 if [[ $ver != "$cur_ver" ]]; then
-  if [[ $HOST2 == $HOSTNAME && $ver != "$($bprogs_dir/btrfs --version 2>/dev/null | awk '{print $2}')" ]]; then
+  if [[ $HOST2 == "$HOSTNAME" && $ver != "$($bprogs_dir/btrfs --version 2>/dev/null | awk '{print $2}')" ]]; then
     rm -rf $bprogs_dir
     cd /tmp
     wget $url
@@ -312,7 +298,7 @@ fi
 ##### end network setup  #####
 
 
-if ifclass VOL_BULLSEYE_BOOTSTRAP; then
+if ifclass VOL_BULLSEYE_BOOTSTRAP || ifclass VOL_BOOKWORM_BOOTSTRAP; then
   fcopy /etc/systemd/system/faicheck.service
   $chroot bash <<'EOFOUTER'
 systemctl enable faicheck.service