#
# 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:
#
# raid10.
# RAID1: forces raid1 filesystem.
+mkroot2tab=false
mkroot2=false
if [[ $1 ]]; then
case $1 in
mkroot2)
mkroot2=true
;;
+ mkroot2tab)
+ mkroot2tab=true
+ ;;
*)
echo "$0: error: unsupported arg: $1" >&2
exit 1
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
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"
boot_mib=10000
root2_mib=1000000
boot2_mib=5000
-elif (( boot_spa_ce > 30000 )); then
+elif (( boot_space > 30000 )); then
boot_mib=$(( 5000 + (boot_space - 30000) / 2 ))
root2_mib=100
boot2_mib=100
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
# 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 <<EOF
$(root2-cryptname) $(root2dev) $luks_file discard,luks,initramfs
EOF
done
- bpart $(for dev in ${devs[@]}; do root2-cryptdev; done)
- bpart ${boot2_devs[@]}
+ if $mkroot2; then
+ bpart $(for dev in ${devs[@]}; do root2-cryptdev; done)
+ bpart ${boot2_devs[@]}
+ fi
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