further bookworm support
authorIan Kelling <iank@fsf.org>
Mon, 22 Apr 2024 16:01:10 +0000 (12:01 -0400)
committerIan Kelling <iank@fsf.org>
Mon, 22 Apr 2024 16:11:40 +0000 (12:11 -0400)
14 files changed:
fai-revm
fai/config/class/FAIBASE.var
fai/config/distro-install-common/end
fai/config/distro-install-common/libreboot_grub.cfg
fai/config/files/etc/fai/nfsroot.conf/FAISERVER
fai/config/files/etc/systemd/system/faicheck.service/VOL_BOOKWORM_BOOTSTRAP [new symlink]
fai/config/files/root/fai-check/VOL_BOOKWORM_BOOTSTRAP [new file with mode: 0755]
fai/config/files/root/fai-check/VOL_BULLSEYE_BOOTSTRAP [changed from file to symlink]
fai/config/hooks/instsoft.DEFAULT
fai/config/hooks/partition.DEFAULT
fai/config/package_config/DEBIAN
fai/config/scripts/IANK/11-iank
faiserver-setup
mymk-basefile

index 8bfb9701c9dd6ad5b8e6d9dd820b77c51c3b430f..050ecdaf90d1523891398ed4094396c1057fd934 100755 (executable)
--- a/fai-revm
+++ b/fai-revm
@@ -140,7 +140,7 @@ else
       BASEFILE_DIR=/tmp
     fi
     isopath=$BASEFILE_DIR/$iso
       BASEFILE_DIR=/tmp
     fi
     isopath=$BASEFILE_DIR/$iso
-    isosrc=$BASEFILE_DIR/BULLSEYE64.tar.gz
+    isosrc=$BASEFILE_DIR/BOOKWORM64.tar.gz
     if [[ ! -e $isopath || $(stat -c %Y $isopath) -lt $(stat -c %Y $isosrc) ]]; then
       e fai-cd -g $(readlink -f grub.cfg.${iso%%.*}) -f -A $isopath
     fi
     if [[ ! -e $isopath || $(stat -c %Y $isopath) -lt $(stat -c %Y $isosrc) ]]; then
       e fai-cd -g $(readlink -f grub.cfg.${iso%%.*}) -f -A $isopath
     fi
index dabfb068d5c79cc44cd2656516e961c8453dc51e..34d95ac80716d80adf6472490acdb76df4a11f3e 100644 (file)
@@ -21,4 +21,4 @@ MAXPACKAGES=800
 #USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
 
 # set a default
 #USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
 
 # set a default
-FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"
+FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian"
index 8ad84c9d0fffc626553f392828a0a1c773adba56..f9a084030917a6ee4d6963b4d5a309dc47e7b46e 100755 (executable)
@@ -32,7 +32,7 @@ au() { # add user. i don't use adduser for portability
 
 
 # only setup root pass for bootstrap vol
 
 
 # only setup root pass for bootstrap vol
-if ifclass VOL_BULLSEYE_BOOTSTRAP; then
+if ifclass VOL_BULLSEYE_BOOTSTRAP || VOL_BOOKWORM_BOOTSTRAP; then
   exit 0
 fi
 
   exit 0
 fi
 
index d9dde28d4bcd0127e6d73603272a6e7d47d40258..5f4d722742a629a4782c30a85eeb402cc3be2a98 100644 (file)
@@ -14,7 +14,7 @@ function save_chosen {
 }
 
 # fai_check is so we can act like a pxe boot, but just for fai, and by
 }
 
 # fai_check is so we can act like a pxe boot, but just for fai, and by
-# using /bullseye_bootstrap to do it.  We toggle on and off the grub var
+# using /bookworm_bootstrap to do it.  We toggle on and off the grub var
 # did_fai_check so we can do the check every other boot. Then
 # /debian_bootstrap checks for that var on boot and if we want to do a
 # fai check, it does it, then reboots. But fai-check also sets
 # did_fai_check so we can do the check every other boot. Then
 # /debian_bootstrap checks for that var on boot and if we want to do a
 # fai check, it does it, then reboots. But fai-check also sets
@@ -25,7 +25,7 @@ function save_chosen {
 # We don't set this to fai check so we can't get into
 # an infinite reboot cycle. We depend on the os to
 # create the initial grubenv file.
 # We don't set this to fai check so we can't get into
 # an infinite reboot cycle. We depend on the os to
 # create the initial grubenv file.
-set default=/debianbullseye_bootstrap # could use 0 here.
+set default=/debianbookworm_bootstrap # could use 0 here.
 set timeout=1
 
 # grub_extn
 set timeout=1
 
 # grub_extn
@@ -44,7 +44,7 @@ done
 
 did_fai_check=false
 
 
 did_fai_check=false
 
-bs_dir=/debianbullseye_bootstrap
+bs_dir=/debianbookworm_bootstrap
 menuentry $bs_dir --id=$bs_dir {
     # note, we might be able to use $chosen and avoid setting this here,
     # and set it inside save_chosen. but I haven't tested it,
 menuentry $bs_dir --id=$bs_dir {
     # note, we might be able to use $chosen and avoid setting this here,
     # and set it inside save_chosen. but I haven't tested it,
index 72491fddb31939a4e294ec91f55e61ce5c06559c..e176a6dd8038cbacab0e9581be0bd477e6382037 100644 (file)
@@ -1,7 +1,7 @@
 # For a detailed description see nfsroot.conf(5)
 
 # "<suite> <mirror>" for debootstrap
 # For a detailed description see nfsroot.conf(5)
 
 # "<suite> <mirror>" for debootstrap
-FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"
+FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian"
 FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
 
 NFSROOT=/srv/fai/nfsroot
 FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
 
 NFSROOT=/srv/fai/nfsroot
diff --git a/fai/config/files/etc/systemd/system/faicheck.service/VOL_BOOKWORM_BOOTSTRAP b/fai/config/files/etc/systemd/system/faicheck.service/VOL_BOOKWORM_BOOTSTRAP
new file mode 120000 (symlink)
index 0000000..82dea76
--- /dev/null
@@ -0,0 +1 @@
+VOL_BULLSEYE_BOOTSTRAP
\ No newline at end of file
diff --git a/fai/config/files/root/fai-check/VOL_BOOKWORM_BOOTSTRAP b/fai/config/files/root/fai-check/VOL_BOOKWORM_BOOTSTRAP
new file mode 100755 (executable)
index 0000000..ebbedbe
--- /dev/null
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
+#set -x
+
+usage() {
+  cat <<EOF
+Usage: ${0##*/} [OPTION] [HOST]
+If grub var set, act like pxe rom and pxe-kexec to faiserver
+
+-f|--force  do kexec if we can reach faiserver
+-h|--help  Print help and exit.
+
+Note: Uses GNU getopt options parsing style
+EOF
+  exit $1
+}
+
+
+
+# Keep it short so we don't delay too much wnen we don't have networking.
+# In practice, on my home network, on an x200, it took 15 seconds, so
+# give it an extra 10 seconds, which seems fairly short as I write this.
+NETWORK_TIMOUT_SECS=25
+did_fai_check=false
+
+m() { printf "%s\n" "$*";  "$@"; }
+
+try-kexec() {
+  deadline=$(( `date +%s` + NETWORK_TIMOUT_SECS ))
+  while ! timeout -s 9 3 nc -zu $faiserver 69; do
+    if (( `date +%s` > deadline )); then
+      echo "fai-check: hit $NETWORK_TIMOUT_SECS s tftp server timeout"
+      return 0
+    fi
+    sleep 1
+  done
+  m pxe-kexec -n --ignore-whitelist -l fai-generated $faiserver ||:
+}
+
+force=false
+case $1 in
+  -h|--help)
+    usage
+    ;;
+  -f|--force)
+    force=true
+    shift
+    ;;
+esac
+
+faiserver=${1:-faiserver.b8.nz}
+
+
+if $force; then
+  try-kexec
+  exit
+fi
+
+# on one machine, I could do this:
+# dmidecode -t system | grep -F "Version: ThinkPad X200"
+# however, on another, the version field just says invalid data.
+# todo: figure out some better way to check if we are on
+# an x200.
+
+if ! dmidecode | grep -i thinkpad &>/dev/null; then
+  echo "not x200, exiting"
+  exit 0
+fi
+
+first=true
+for dev in $(btrfs fi show / | sed -rn 's#^\s*devid\s.*\s([^0-9 ]+)\S+$#\1#p' \
+               |sort); do
+  echo dev=$dev
+  found=false
+  # Decide which is my grub_ext partition. see partition.DEFAULT file
+  # for details. currently it is 4
+  for (( i=4; i<=7; i++ )); do
+    if [[ $(blockdev --getsize64 ${dev}$i) == 8388608 ]]; then
+      grub_extn=${dev}$i
+      found=true
+      echo grub_extn=$grub_extn
+      break
+    fi
+  done
+  if ! $found; then
+    echo "$0: error: failed to find grub_ext partition."
+    exit 1
+  fi
+  m mount $grub_extn /mnt
+  if $first; then
+    if [[ -e /mnt/grubenv ]]; then
+      m grub-editenv /mnt/grubenv list
+      source <(grub-editenv /mnt/grubenv list)
+    fi
+    first=false
+    # we could just as well check if last_boot != /debianbullseye_bootstrap
+    # the intent with this one is just a little clearer.
+    if [[ $did_fai_check == true ]]; then
+      m grub-editenv /mnt/grubenv set did_fai_check=os_true
+      # our service does not wait for network-online.target,
+      # because it will wait for too long when we don't have a network
+      # connection. So, we wait for 10 seconds.
+      # ref: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
+      try-kexec ||:
+    fi
+  else
+    # we make sure there is only 1 grubenv,
+    # so grub can just find the first one, in whatever order
+    # if looks at them, which may not be the same as us.
+    # If the disk dies, we just lose the default boot option,
+    # we will have to do manual steps to replace it anyways.
+    m rm -f /mnt/gruvenv
+  fi
+  m umount /mnt
+done
+
+# the check for last_boot is not needed afaik, just sanity check.
+case $did_fai_check in
+  true|os_true)
+    if [[ $last_boot != /debian*_bootstrap ]]; then
+      # no need to reboot if we actually want to boot into this os.
+      echo "last_boot=$last_boot not debian*_bootstrap, rebooting"
+      reboot
+    fi
+esac
deleted file mode 100755 (executable)
index 34f682f10dae8c358843a2a3cb4371d4f8fa7567..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/bin/bash
-
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-
-#set -x
-
-usage() {
-  cat <<EOF
-Usage: ${0##*/} [OPTION] [HOST]
-If grub var set, act like pxe rom and pxe-kexec to faiserver
-
--f|--force  do kexec if we can reach faiserver
--h|--help  Print help and exit.
-
-Note: Uses GNU getopt options parsing style
-EOF
-  exit $1
-}
-
-
-
-# Keep it short so we don't delay too much wnen we don't have networking.
-# In practice, on my home network, on an x200, it took 15 seconds, so
-# give it an extra 10 seconds, which seems fairly short as I write this.
-NETWORK_TIMOUT_SECS=25
-did_fai_check=false
-
-m() { printf "%s\n" "$*";  "$@"; }
-
-try-kexec() {
-  deadline=$(( `date +%s` + NETWORK_TIMOUT_SECS ))
-  while ! timeout -s 9 3 nc -zu $faiserver 69; do
-    if (( `date +%s` > deadline )); then
-      echo "fai-check: hit $NETWORK_TIMOUT_SECS s tftp server timeout"
-      return 0
-    fi
-    sleep 1
-  done
-  m pxe-kexec -n --ignore-whitelist -l fai-generated $faiserver ||:
-}
-
-force=false
-case $1 in
-  -h|--help)
-    usage
-    ;;
-  -f|--force)
-    force=true
-    shift
-    ;;
-esac
-
-faiserver=${1:-faiserver.b8.nz}
-
-
-if $force; then
-  try-kexec
-  exit
-fi
-
-# on one machine, I could do this:
-# dmidecode -t system | grep -F "Version: ThinkPad X200"
-# however, on another, the version field just says invalid data.
-# todo: figure out some better way to check if we are on
-# an x200.
-
-if ! dmidecode | grep -i thinkpad &>/dev/null; then
-  echo "not x200, exiting"
-  exit 0
-fi
-
-first=true
-for dev in $(btrfs fi show / | sed -rn 's#^\s*devid\s.*\s([^0-9 ]+)\S+$#\1#p' \
-               |sort); do
-  echo dev=$dev
-  found=false
-  # Decide which is my grub_ext partition. see partition.DEFAULT file
-  # for details. currently it is 4
-  for (( i=4; i<=7; i++ )); do
-    if [[ $(blockdev --getsize64 ${dev}$i) == 8388608 ]]; then
-      grub_extn=${dev}$i
-      found=true
-      echo grub_extn=$grub_extn
-      break
-    fi
-  done
-  if ! $found; then
-    echo "$0: error: failed to find grub_ext partition."
-    exit 1
-  fi
-  m mount $grub_extn /mnt
-  if $first; then
-    if [[ -e /mnt/grubenv ]]; then
-      m grub-editenv /mnt/grubenv list
-      source <(grub-editenv /mnt/grubenv list)
-    fi
-    first=false
-    # we could just as well check if last_boot != /debianbullseye_bootstrap
-    # the intent with this one is just a little clearer.
-    if [[ $did_fai_check == true ]]; then
-      m grub-editenv /mnt/grubenv set did_fai_check=os_true
-      # our service does not wait for network-online.target,
-      # because it will wait for too long when we don't have a network
-      # connection. So, we wait for 10 seconds.
-      # ref: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
-      try-kexec ||:
-    fi
-  else
-    # we make sure there is only 1 grubenv,
-    # so grub can just find the first one, in whatever order
-    # if looks at them, which may not be the same as us.
-    # If the disk dies, we just lose the default boot option,
-    # we will have to do manual steps to replace it anyways.
-    m rm -f /mnt/gruvenv
-  fi
-  m umount /mnt
-done
-
-# the check for last_boot is not needed afaik, just sanity check.
-case $did_fai_check in
-  true|os_true)
-    if [[ $last_boot != /debianbullseye_bootstrap ]]; then
-      # no need to reboot if we actually want to boot into this os.
-      echo "last_boot not debianbullseye_bootstrap, rebooting"
-      reboot
-    fi
-esac
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..18c54ebb27726401a35321a417a6bd40339f28d3
--- /dev/null
@@ -0,0 +1 @@
+VOL_BOOKWORM_BOOTSTRAP
\ No newline at end of file
index 3bf0f62939ff27719751f0037dc7b5f1abbfb649..42f97392c474d02e55baa72817c71fcedd69e875 100755 (executable)
@@ -3,7 +3,7 @@
 # These are things we can do before package_config packages get installed.
 
 # exit for any vm except demohost, or if we are doing a dirinstall
 # These are things we can do before package_config packages get installed.
 
 # exit for any vm except demohost, or if we are doing a dirinstall
-if ifclass VM && ! ifclass demohost || ifclass VOL_BULLSEYE_BOOTSTRAP || [[ ! $FAI_ACTION || $FAI_ACTION = dirinstall ]]; then
+if ifclass VM && ! ifclass demohost || ifclass VOL_BULLSEYE_BOOTSTRAP || ifclass VOL_BOOKWORM_BOOTSTRAP || [[ ! $FAI_ACTION || $FAI_ACTION = dirinstall ]]; then
   exit 0
 fi
 
   exit 0
 fi
 
index 63235f171b25cb21a5953e8afe05a3fe4ebbcc61..18f5a23a39f453d152c34a1d555b20b0d720761d 100755 (executable)
@@ -272,7 +272,7 @@ mktab() {
   dev=${boot_devs[0]}
   fstabstd="x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s"
 
   dev=${boot_devs[0]}
   fstabstd="x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s"
 
-  if [[ $DISTRO == debianbullseye_bootstrap ]]; then
+  if [[ $DISTRO == *_bootstrap ]]; then
     cat > /tmp/fai/fstab <<EOF
 $first_boot_dev  /  btrfs  noatime,subvol=$boot_vol  0 0
 $first_efi  /boot/efi  vfat          nofail,$fstabstd  0 0
     cat > /tmp/fai/fstab <<EOF
 $first_boot_dev  /  btrfs  noatime,subvol=$boot_vol  0 0
 $first_efi  /boot/efi  vfat          nofail,$fstabstd  0 0
@@ -692,7 +692,9 @@ fi
 
 
 if [[ ! $DISTRO ]]; then
 
 
 if [[ ! $DISTRO ]]; then
-  if ifclass VOL_BULLSEYE_BOOTSTRAP; then
+  if ifclass VOL_BOOKWORM_BOOTSTRAP; then
+    DISTRO=debianbookworm_bootstrap
+  elif ifclass VOL_BULLSEYE_BOOTSTRAP; then
     DISTRO=debianbullseye_bootstrap
   elif ifclass VOL_STRETCH; then
     DISTRO=debianstretch
     DISTRO=debianbullseye_bootstrap
   elif ifclass VOL_STRETCH; then
     DISTRO=debianstretch
@@ -728,7 +730,7 @@ if [[ ! $DISTRO ]]; then
   fi
 fi
 
   fi
 fi
 
-if [[ $DISTRO == debianbullseye_bootstrap ]]; then
+if [[ $DISTRO == *_bootstrap ]]; then
   # this is just convenience for the libreboot_grub config
   # so we can glob the other ones easier.
   boot_vol=$DISTRO
   # this is just convenience for the libreboot_grub config
   # so we can glob the other ones easier.
   boot_vol=$DISTRO
@@ -1020,7 +1022,7 @@ else ## end if $partition ##
 fi
 
 
 fi
 
 
-if $wipe && [[ $DISTRO != debianbullseye_bootstrap ]]; then
+if $wipe && [[ $DISTRO != *_bootstrap ]]; then
   # bootstrap distro doesn't use separate encrypted root.
   mount -o subvolid=0 ${root_devs[0]} /mnt
   # systemd creates subvolumes we want to delete.
   # bootstrap distro doesn't use separate encrypted root.
   mount -o subvolid=0 ${root_devs[0]} /mnt
   # systemd creates subvolumes we want to delete.
index 0ceedded7e74fe72d829c62edeb814cb12e666f4..6e43c2326e1e6f4d828180becf8e0c902a99bf93 100644 (file)
@@ -1,6 +1,6 @@
 # otherwise sshd takes like 10 seconds to start.
 # not sure if this applies to bullseye or just buster, installing it so i dun have to worry.
 # otherwise sshd takes like 10 seconds to start.
 # not sure if this applies to bullseye or just buster, installing it so i dun have to worry.
-PACKAGES install BUSTER BULLSEYE
+PACKAGES install BUSTER BULLSEYE BOOKWORM
 haveged
 
 PACKAGES install NONFREE
 haveged
 
 PACKAGES install NONFREE
index 6efc767dc344021a59875811401c271928bb62b9..63c85f96e992452999a349210252fd05af96595a 100755 (executable)
@@ -298,7 +298,7 @@ fi
 ##### end network setup  #####
 
 
 ##### 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
   fcopy /etc/systemd/system/faicheck.service
   $chroot bash <<'EOFOUTER'
 systemctl enable faicheck.service
index 959b7d33dea68fc765059c84478678cea9e98291..666774b7e8dff42dc32bc0341ec9b303db2e51b7 100755 (executable)
@@ -30,7 +30,7 @@ as the tftp server. I vaguely remember that using a hostname does not
 work.  Separate from running this, faiserver needs to be setup in dns to
 point to whatever host this is run on.
 
 work.  Separate from running this, faiserver needs to be setup in dns to
 point to whatever host this is run on.
 
-Default BASE_CODENAME is bullseye. Default ARCH is 64. The script expects corresponding
+Default BASE_CODENAME is bookworm. Default ARCH is 64. The script expects corresponding
 $BASEFILE_DIR/${UPCASED_BASE_CODENAME}${ARCH}.tar.(gz|xz) to exist, and it must have been
 generated around the same time as the nfsroot, at least so it has the
 same kernel version.
 $BASEFILE_DIR/${UPCASED_BASE_CODENAME}${ARCH}.tar.(gz|xz) to exist, and it must have been
 generated around the same time as the nfsroot, at least so it has the
 same kernel version.
@@ -65,7 +65,7 @@ esac
 e() { echo "+ $@"; "$@"; }
 
 
 e() { echo "+ $@"; "$@"; }
 
 
-base=${1:-bullseye}
+base=${1:-bookworm}
 arch=${2:-64}
 
 if [[ $base == [[:upper:]] ]]; then
 arch=${2:-64}
 
 if [[ $base == [[:upper:]] ]]; then
@@ -101,7 +101,7 @@ wget -O - https://fai-project.org/download/2BF8D9FE074BCDE4.asc | apt-key add -
 
 update=false
 case $base in
 
 update=false
 case $base in
-  stretch|buster|bullseye)
+  stretch|buster|bullseye|bookworm)
     if ! grep -qFx "deb https://fai-project.org/download $base koeln" /etc/apt/sources.list.d/fai.list; then
       update=true
     fi
     if ! grep -qFx "deb https://fai-project.org/download $base koeln" /etc/apt/sources.list.d/fai.list; then
       update=true
     fi
index 62f2924bfbb2431d13bff7ca8530accdb914fdca..9dc7b14ce49aad00dc12349b0ba46022172b811f 100755 (executable)
@@ -32,6 +32,7 @@ them often. Better to build our all our own.
 
 Args I've used before:
 
 
 Args I've used before:
 
+-z BOOKWORM64
 -z BULLSEYE64
 -z BUSTER64
 -z STRETCH64
 -z BULLSEYE64
 -z BUSTER64
 -z STRETCH64