From: Ian Kelling Date: Mon, 8 Aug 2022 03:11:24 +0000 (-0400) Subject: t11 and new partitioner fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=d9993568d38dd7d2d18ced6b5007e9cc07d1e576;p=automated-distro-installer t11 and new partitioner fixes --- diff --git a/fai/config/distro-install-common/devbyid b/fai/config/distro-install-common/devbyid index 056a83f..af97643 100755 --- a/fai/config/distro-install-common/devbyid +++ b/fai/config/distro-install-common/devbyid @@ -4,17 +4,21 @@ # output: /dev/disk/by-id/model+serial, or if no link exists, the same as input short_dev=$1 +if [[ ! -e $short_dev ]]; then + echo "devbyid: error: argument=$short_dev does not exist" + exit 1 +fi # devices are identified by model+serial num # and for ssd/hdd: wwn, and for nvme: eui. # model+serial gives me more info, so use that. shopt -s extglob for id in /dev/disk/by-id/!(nvme-eui*|wwn*); do - [[ -e $id ]] || break # if we matched nothing - if [[ $(readlink -f $id) == "$short_dev" ]]; then - printf '%s\n' "$id" - exit - fi + [[ -e $id ]] || break # if we matched nothing + if [[ $(readlink -f $id) == "$short_dev" ]]; then + printf '%s\n' "$id" + exit + fi done # a vm may not have a by-id link. printf '%s\n' "$short_dev" diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 7990a19..1586e48 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -358,6 +358,7 @@ EOF # todo: update for lvm doroot2() { + # We write to these files instead of just /etc/fstab, /etc/crypttab, # because these are filesystems created after our current root, and so # this allows us to update other root filesystems too. @@ -366,10 +367,16 @@ doroot2() { echo $0: error: found partition=true but have mkroot2 arg exit 1 fi + + root2_devs=() for vg in ${vgs[@]}; do + + root2_devs+=(/dev/mapper/crypt-$vg-root2) if $mkroot2; then + lvcreate -y -L $root2_part_mib $vg -n root2 + lvcreate -y -L $boot2_part_mib $vg -n boot2 luks-setup /dev/$vg/root2 crypt-$vg-root2 fi cat >>/mnt/root/root2-crypttab < 0 )) || exit 1 + if (( count_down <= 0 )); then + echo "$0: wipefs failed 10 times. exiting" >&2 + exit 1 + fi done done fi @@ -869,12 +883,6 @@ if $partition; then fi fi - if zilap; then - # todo: now that we are using lvm, this doesnt need to be done until mkroot2 - lvcreate -y -L $root2_part_mib $vg -n root2 - lvcreate -y -L $boot2_part_mib $vg -n boot2 - fi - $pcmd mkpart primary "" ${pv_end}MiB ${disk_mib}MiB $pcmd name $bootn boot $pcmd set $bootn boot on diff --git a/faiserver-setup b/faiserver-setup index 4003a24..959b7d3 100755 --- a/faiserver-setup +++ b/faiserver-setup @@ -294,6 +294,12 @@ else # not armhf e fai-setup -evf -B $basefile # fai-setup expert mode avoids writing to /var/log/fai/variables # at least config_src is needed for autodiscover + + + # lld /var/log/fai/remote-logs: + # d 750 fai nogroup 100 08-07 08:51 pm /var/log/fai/remote-logs + # We could change the group or something, but why not just give me more permissions :) + e usermod -a -G nogroup iank $sed '/^FAI_CONFIGDIR|^FAI_CONFIG_SRC|^LOGUSER/d' /var/log/fai/variables tee -a /var/log/fai/variables <<'EOF' LOGUSER=fai