small fixes and config changes
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index 317eb6d3b9b149069fcc3b0f8fce4c94da0ef93c..fac3155a98e03cb3f08e25eb32f1f1d24b4f8bb5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash -x
 
 set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 # # fai's setup-storage won't do btrfs on luks,
 # # so we do it ourself :)
@@ -173,6 +173,12 @@ first_boot_dev=$(bootdev ${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
@@ -317,6 +323,13 @@ $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`)