-# 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.
+#
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
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
elif ifclass VOL_STRETCH; then
DISTRO=debianstretch
elif ifclass VOL_BUSTER; then
DISTRO=debianbuster
elif ifclass VOL_BULLSEYE; then
DISTRO=debianbullseye
elif ifclass VOL_STRETCH; then
DISTRO=debianstretch
elif ifclass VOL_BUSTER; then
DISTRO=debianbuster
elif ifclass VOL_BULLSEYE; then
DISTRO=debianbullseye
# 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
# 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
cat >>/mnt/root/root2-crypttab <<EOF
$(root2-cryptname) $(root2dev) $luks_file discard,luks,initramfs
EOF
done
cat >>/mnt/root/root2-crypttab <<EOF
$(root2-cryptname) $(root2dev) $luks_file discard,luks,initramfs
EOF
done
mkdir -p /mnt/root2 /mnt/boot2
cat >>/mnt/root/root2-fstab <<EOF
$(root2-cryptdev ${devs[0]}) /mnt/root2 btrfs nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,subvolid=0$mopts 0 0
mkdir -p /mnt/root2 /mnt/boot2
cat >>/mnt/root/root2-fstab <<EOF
$(root2-cryptdev ${devs[0]}) /mnt/root2 btrfs nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,subvolid=0$mopts 0 0
# bootstrap distro doesn't use separate encrypted root.
mount -o subvolid=0 $first_root_crypt /mnt
# systemd creates subvolumes we want to delete.
# bootstrap distro doesn't use separate encrypted root.
mount -o subvolid=0 $first_root_crypt /mnt
# systemd creates subvolumes we want to delete.
cat > /tmp/fai/fstab <<EOF
$first_boot_dev / btrfs noatime,subvol=$boot_vol 0 0
$first_efi /boot/efi vfat nofail,$fstabstd 0 0
cat > /tmp/fai/fstab <<EOF
$first_boot_dev / btrfs noatime,subvol=$boot_vol 0 0
$first_efi /boot/efi vfat nofail,$fstabstd 0 0