esac
}
-first_boot_dev=$(bootdev ${devs[0]})
+first_boot_dev=${boot_devs[0]}
# keyfiles generated like:
# head -c 2048 /dev/urandom | od | s dd of=/q/root/luks/host-demohost
luks_dir=${LUKS_DIR:-/var/lib/fai/config/distro-install-common/luks}
+
+if [[ ! -e $luks_dir/host-$HOSTNAME ]]; then
+ echo "$0: error: no key for hostname at $luks_dir/host-$HOSTNAME" >&2
+ exit 1
+fi
+
if ifclass tp; then
lukspw=$(cat $luks_dir/traci)
else
awk '{print $2}') * 3/(${#devs[@]} * 2 ) / 1024 ))
mkdir -p /tmp/fai
+root_devs=()
+for dev in ${devs[@]}; do
+ root_devs+=(`rootdev`)
+done
shopt -s nullglob
if $partition; then
for dev in ${devs[@]}; do
btrfs subvolume set-default 0 /mnt
[[ ! -e /mnt/root_$DISTRO ]] || btrfs subvolume delete /mnt/root_$DISTRO
-
## create subvols ##
cd /mnt
-for x in q home_$DISTRO root_$DISTRO; do
- btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x
-done
+btrfs subvolume create root_$DISTRO
+[[ -e q ]] || btrfs subvolume create q
chown root:1000 q
-
mkdir -p /mnt/root_$DISTRO/boot
for x in root/a q/a; do
mkdir -p $x
$first_root_crypt / btrfs noatime,subvol=root_$DISTRO 0 0
$first_root_crypt /q btrfs noatime,subvol=q 0 0
/q/a /a none bind 0 0
-$first_root_crypt /home btrfs noatime,subvol=home_$DISTRO 0 0
$first_boot_dev /boot btrfs noatime,subvol=boot_$DISTRO 0 0
EOF
+
+if ifclass treetowl; then
+ cat >> /tmp/fai/fstab <<'EOF'
+UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs noatime 0 2
+EOF
+fi
+
swaps=()
for dev in ${devs[@]}; do
swaps+=(`swap-cryptname`)
#BOOT_DEVICE=\${BOOT_DEVICE:-"${devs[0]}"}
# swaplist seems to do nothing.
+
cat >/tmp/fai/disk_var.sh <<EOF
+# ROOT_PARTITIONS is added by me, used in arch setup.
+ROOT_PARTITIONS="${root_devs[@]}"
ROOT_PARTITION=\${ROOT_PARTITION:-$first_root_crypt}
BOOT_PARTITION=\${BOOT_PARTITION:-$first_boot_dev}
BOOT_DEVICE="${short_devs[@]}"