X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fhooks%2Fpartition.DEFAULT;h=410b915651aef26b658fce62fc3492c2c173d395;hb=ceeb4e46d3bb326d01fcc7ed98d94ab0b580eda3;hp=7990a19918faf90e56760428b54fce9e032f1120;hpb=137ffae7de84a51c4b438ccf2fb50f5571f522a6;p=automated-distro-installer diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 7990a19..410b915 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 @@ -852,8 +866,13 @@ if $partition; then # so use fixed sizes to allow both to grow # 600 = uefi 512 + grubext 8 + bios grub 3 + some extra cuz this is lvm #root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 )) - root_mib=$(( 1000 * 1000 )) # * 1000 to make it in gb. o_mib=$(( 120 * 1000 )) + # max minus o, minus a gig just for some extra space + max_root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 - o_mib - 1000 )) + root_mib=$(( 1000 * 1000 )) # * 1000 to make it in gb. + if (( max_root_mib < root_mib )); then + root_mib=$max_root_mib + fi fi if [[ ! $SPECIAL_DISK ]]; then @@ -869,12 +888,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