X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fhooks%2Fpartition.DEFAULT;h=f3df8652b9532ab4f38f97ed70ad30ecd6c01e0d;hb=c59144a600fd661d9512d8a5005aa0f5bc29bf0d;hp=f98e59556cb8dc338a0c6a3eb6e96344d2c4e68c;hpb=0c400e34881621fa39a4d0bbf4403209e81efcfa;p=automated-distro-installer diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index f98e595..f3df865 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -35,7 +35,11 @@ fi # # OPTIONS: # -# mkroot2: for running outside of fai and setting up the root2/boot2 luks and btrfs +# mkroot2: for running outside of fai and setting up the root2/boot2 luks and btrfs and tab files +# +# mkroot2tab: for running outside of fai and setting up the root2/boot2 tab files, in case luks and btrfs +# happen to already be setup. +# # # environment variables: # @@ -64,17 +68,22 @@ fi # raid10. # RAID1: forces raid1 filesystem. +mkroot2tab=false mkroot2=false -case $1 in - mkroot2) - mkroot2=true - ;; - *) - echo "$0: error: unsupported arg: $1" >&2 - exit 1 - ;; -esac - +if [[ $1 ]]; then + case $1 in + mkroot2) + mkroot2=true + ;; + mkroot2tab) + mkroot2tab=true + ;; + *) + echo "$0: error: unsupported arg: $1" >&2 + exit 1 + ;; + esac +fi if [[ $SPECIAL_DISK ]]; then @@ -90,7 +99,7 @@ skiptask partition || ! type skiptask if ! type -p devbyid; then for d in $FAI/distro-install-common \ - /a/bin/fai/fai/config/distro-install-common $FAI $PWD; do + /a/bin/fai/fai/config/distro-install-common $FAI $PWD; do [[ -d $d ]] || continue if [[ -e $d/devbyid ]]; then devbyid=$d/devbyid @@ -185,8 +194,7 @@ luks-setup() { # cryptsetup luksAddKey --pbkdf pbkdf2 # then remove the new format keys with cryptsetup luksRemoveKey # then cryptsetup convert DEV --type luks1, then readd old keys and remove temp. - yes YES | cryptsetup luksFormat $luksdev $luks_file \ - --type luks1 -c aes-cbc-essiv:sha256 -s 256 || [[ $? == 141 ]] + yes YES | cryptsetup luksFormat $luksdev $luks_file || [[ $? == 141 ]] yes "$lukspw" | \ cryptsetup luksAddKey --key-file $luks_file \ $luksdev || [[ $? == 141 ]] @@ -220,7 +228,7 @@ if (($(nproc) > 2)); then fi declare -A disk_excludes -if ! $mkroot2 && ! ifclass USE_MOUNTED; then +if ! $mkroot2 && ! $mkroot2tab ! ifclass USE_MOUNTED; then ## ignore disks that are mounted, eg when running from fai-cd while read -r l; do eval "$l" @@ -360,17 +368,18 @@ if (( boot_space > 60000 )); then # becuase I keep a minimal debian install on it for # recovery needs and for doing pxe-kexec. boot_mib=10000 - root2_mib=200000 - boot2_mib=2000 -elif (( boot_spa_ce > 30000 )); then + root2_mib=1000000 + boot2_mib=5000 +elif (( boot_space > 30000 )); then boot_mib=$(( 5000 + (boot_space - 30000) / 2 )) root2_mib=100 boot2_mib=100 else # Small vms don't have room for /boot recovery. With 3 kernels # installed, i'm using 132M on t8, so this seems like plenty of - # room. note: rhel 8 recomments 1g for /boot. - boot_mib=500 + # room. note: rhel 8 recomments 1g for /boot. u20.04 with 3 kernels = + # 308 mb, so things have grown significantly + boot_mib=1000 root2_mib=100 boot2_mib=100 fi @@ -386,14 +395,16 @@ esac if [[ ! $DISTRO ]]; then - if ifclass VOL_BUSTER_BOOTSTRAP; then - DISTRO=debianbuster_bootstrap + if ifclass VOL_BULLSEYE_BOOTSTRAP; then + DISTRO=debianbullseye_bootstrap elif ifclass VOL_STRETCH; then DISTRO=debianstretch elif ifclass VOL_BUSTER; then DISTRO=debianbuster elif ifclass VOL_BULLSEYE; then DISTRO=debianbullseye + elif ifclass VOL_BOOKWORM; then + DISTRO=debianbookworm elif ifclass VOL_TESTING; then DISTRO=debiantesting elif ifclass VOL_XENIAL; then @@ -408,7 +419,7 @@ if [[ ! $DISTRO ]]; then DISTRO=trisqueletiona elif ifclass VOL_NABIA; then DISTRO=trisquelnabia - elif $mkroot2; then + elif $mkroot2 || $mkroot2tab; then : else echo "PARTITIONER ERROR: no distro class/var set" >&2 @@ -478,21 +489,25 @@ shopt -s nullglob # because these are filesystems created after our current root, and so # this allows us to update other root filesystems too. rm -f /mnt/root/root2-{fs,crypt}tab -if $mkroot2; then +if $mkroot2 || $mkroot2tab; then if $partition; then echo $0: error: found partition=true but have mkroot2 arg exit 1 fi for dev in ${devs[@]}; do - luks_file=$luks_dir/host-amy - lukspw=$(cat $luks_dir/amy) - luks-setup $(root2dev) + if $mkroot2; then + luks_file=$luks_dir/host-amy + lukspw=$(cat $luks_dir/amy) + luks-setup $(root2dev) + fi cat >>/mnt/root/root2-crypttab <>/mnt/root/root2-fstab < /tmp/fai/fstab <