From 61c3a58fcfadab7c333487f887b3f9f3a53bb93a Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 4 Mar 2021 13:22:54 -0500 Subject: [PATCH] various fixes and dns changes --- fai-revm | 21 +++++++++++-- .../distro-install-common/libreboot_grub.cfg | 2 +- fai/config/files/boot/chboot/DEFAULT | 10 +++++-- .../files/root/fai-check/VOL_BUSTER_BOOTSTRAP | 9 +++++- fai/config/hooks/partition.DEFAULT | 24 +++++++++++++-- fai/config/scripts/GRUB_PC/11-iank | 5 ++-- grub.cfg.autodiscover | 4 +-- grub.cfg.netinst | 2 +- grub.cfg.netinst-noreboot | 2 +- myfai-chboot-local | 5 +++- wrt-setup-local | 30 ++++++++++++++----- 11 files changed, 92 insertions(+), 22 deletions(-) diff --git a/fai-revm b/fai-revm index acf0db2..1b9897e 100755 --- a/fai-revm +++ b/fai-revm @@ -71,9 +71,21 @@ done # change this to test different disk counts. 1 and > 1 should be the only # important things to test. -disk_count=2 +disk_count=1 +if ! ip l show br0 &>/dev/null; then + cat <<'EOF' +fai-rvm error: no bridge detected. add one to interfaces like this: +iface eth0 inet manual +iface br0 inet dhcp + bridge_ports eth0 + bridge_stp off + bridge_maxwait 0 +EOF + exit 1 +fi + if [[ $script_dir == /a/bin/* ]]; then # Copy our script elsewhere so we can develop it # and save it at the same time it's running @@ -157,8 +169,13 @@ e sudo iptables -P FORWARD ACCEPT # ${disk_arg[*]} -w bridge=br0,mac=52:54:00:9c:ef:ad $reboot_arg \ # --graphics spice,listen=0.0.0.0 $console_arg |& grep -v '^ *$' | uniq & +cpus=1 +if (( $(nproc) > 2 )); then + cpus=2 +fi + e sudo systemctl start libvirtd -e sudo virt-install --rng /dev/urandom --os-variant $variant -n $name $boot_arg -r 2048 --vcpus 1 \ +e sudo virt-install --rng /dev/urandom --os-variant $variant -n $name $boot_arg -r 2048 --vcpus $cpus \ ${disk_arg[*]} -w bridge=br0,mac=52:54:00:9c:ef:ad $reboot_arg \ --graphics spice,listen=0.0.0.0 $console_arg |& grep -v '^ *$' | uniq & diff --git a/fai/config/distro-install-common/libreboot_grub.cfg b/fai/config/distro-install-common/libreboot_grub.cfg index 84fa4e2..16fec9c 100644 --- a/fai/config/distro-install-common/libreboot_grub.cfg +++ b/fai/config/distro-install-common/libreboot_grub.cfg @@ -28,7 +28,7 @@ function save_chosen { set default=/debianbuster_bootstrap # could use 0 here. set timeout=1 -for part in (ahci*4) (ata*4); do +for part in (ahci*5) (ata*5); do envfile=$part/grubenv if [ -s $envfile ]; then load_env --file $envfile diff --git a/fai/config/files/boot/chboot/DEFAULT b/fai/config/files/boot/chboot/DEFAULT index 4abb486..6354ed9 100755 --- a/fai/config/files/boot/chboot/DEFAULT +++ b/fai/config/files/boot/chboot/DEFAULT @@ -64,7 +64,6 @@ EOF } -grub_extn=4 ###### begin command line parsing ##### reboot=true @@ -125,7 +124,14 @@ for boot_dev in $(btrfs fil show $mnt | sed -nr 's#.*path\s+(\S+)$#\1#p'); do e umount $mount_point done -e mount $boot_disk$grub_extn $mount_point +if [[ $(blockdev --getsize64 ${boot_disk}4) == 8388608 ]]; then + # old partition scheme + grub_dev=${boot_disk}4 +else + grub_dev=${boot_disk}5 +fi + +e mount $grub_dev $mount_point e grub-editenv $mount_point/grubenv set last_boot=/$distro e grub-editenv $mount_point/grubenv set did_fai_check=true e umount $mount_point diff --git a/fai/config/files/root/fai-check/VOL_BUSTER_BOOTSTRAP b/fai/config/files/root/fai-check/VOL_BUSTER_BOOTSTRAP index 283bbf6..cff15ed 100755 --- a/fai/config/files/root/fai-check/VOL_BUSTER_BOOTSTRAP +++ b/fai/config/files/root/fai-check/VOL_BUSTER_BOOTSTRAP @@ -47,10 +47,17 @@ case $1 in ;; esac + first=true for dev in $(btrfs fi show / | sed -rn 's#^\s*devid\s.*\s([^0-9 ]+)\S+$#\1#p' \ |sort); do - dev+=4 + + if [[ $(blockdev --getsize64 ${boot_disk}4) == 8388608 ]]; then + # old partition scheme + dev+=4 + else + dev+=5 + fi mount $dev /mnt if $first; then if [[ -e /mnt/grubenv ]]; then diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index bb625fd..61da95a 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -29,8 +29,10 @@ fi # s # source /b/fai/fai-wrapper # - set any appropriate classes with: fai-setclass OPT1... which sets CLASS_OPT1=true... -# or run eval-fai-classfile FILE -# export luks_dir=/q/root/luks +# or run eval-fai-classfile FILE. +# - Set a VOL_DISTROVER, eg: +# fai-setclass VOL_NABIA +# - export luks_dir=/q/root/luks # # OPTIONS: # @@ -650,3 +652,21 @@ ROOT_PARTITION=\${ROOT_PARTITION:-$first_root_crypt} SWAPLIST=\${SWAPLIST:-"${swaps[@]}"} EOF fi + +# initial setup of extra data fs, mounted, +# btrfs subvol create nocow +# chattr +C nocow +# chown iank.iank nocow + +if [[ $HOSTNAME == kd ]]; then + cat >>/tmp/fai/crypttab <> /tmp/fai/fstab <