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
#USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
# set a default
-FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"
+FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian"
# 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
}
# 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
# 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
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,
# 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
--- /dev/null
+VOL_BULLSEYE_BOOTSTRAP
\ No newline at end of file
--- /dev/null
+#!/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
+++ /dev/null
-#!/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
--- /dev/null
+VOL_BOOKWORM_BOOTSTRAP
\ No newline at end of file
# 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
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
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
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
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.
# 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
##### 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
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.
e() { echo "+ $@"; "$@"; }
-base=${1:-bullseye}
+base=${1:-bookworm}
arch=${2:-64}
if [[ $base == [[:upper:]] ]]; then
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
Args I've used before:
+-z BOOKWORM64
-z BULLSEYE64
-z BUSTER64
-z STRETCH64