various changes around data volumes
[distro-setup] / mount-latest-subvol
index f62f1f45612d274f1bf8196e9971973d10bba356..73709316d39b79dac8865aef265b0496574d0fc2 100644 (file)
@@ -73,34 +73,6 @@ $first_root_crypt  /p  btrfs  noatime,subvol=p  0 0
 EOF
         ;;
 esac
-if [[ $HOSTNAME == treetowl ]]; then
-    # partitioned it with fai partitioner outside of fai,
-    # because it\'s worth it to have 1% space reserved for boot and
-    # swap partitions in case I ever want to boot off those drives.
-    # as root:
-    # . /a/bin/fai/fai-wrapper
-    # eval-fai-classfile /a/bin/fai/fai/config/class/51-multi-boot
-    # fai-setclass ROTATIONAL
-    # export LUKS_DIR=/q/root/luks/
-    # # because the partition nums existed already
-    # fai-setclass REPARTITION
-    # /a/bin/fai/fai/config/hooks/partition.DEFAULT
-
-    # just the first in the btrfs raid
-    dev=ata-TOSHIBA_MD04ACA500_84REK6NTFS9A-part1
-    tu /etc/fstab <<EOF
-/dev/mapper/crypt_dev_$dev /i btrfs  noatime,subvol=i  0 0
-EOF
-    tu /etc/crypttab <<EOF
-crypt_dev_$dev  /dev/disk/by-id/$dev  /q/root/luks/host-treetowl  discard,luks
-EOF
-
-else
-    tu /etc/fstab <<'EOF'
-/q/i  /i  none  bind  0 0
-EOF
-
-fi
 
 for vol in q p; do
     d=/$vol
@@ -170,4 +142,46 @@ for vol in q p; do
         e mnt $dir
     done
 done
+
+if [[ $HOSTNAME == treetowl ]]; then
+    # partitioned it with fai partitioner outside of fai,
+    # because it\'s worth it to have 1% space reserved for boot and
+    # swap partitions in case I ever want to boot off those drives.
+    # as root:
+    # . /a/bin/fai/fai-wrapper
+    # eval-fai-classfile /a/bin/fai/fai/config/class/51-multi-boot
+    # fai-setclass ROTATIONAL
+    # export LUKS_DIR=/q/root/luks/
+    # # because the partition nums existed already
+    # fai-setclass REPARTITION
+    # /a/bin/fai/fai/config/hooks/partition.DEFAULT
+
+    devs=(
+        ata-TOSHIBA_MD04ACA500_84REK6NTFS9A-part1
+        ata-TOSHIBA_MD04ACA500_84R2K773FS9A-part1
+        ata-TOSHIBA_MD04ACA500_8471K430FS9A-part1
+        ata-TOSHIBA_MD04ACA500_8481K493FS9A-part1
+    )
+    first=true
+    for dev in ${devs[@]}; do
+        if $first; then
+            first=false
+            tu /etc/fstab <<EOF
+/dev/mapper/crypt_dev_$dev /i btrfs  noatime,subvol=i,noauto  0 0
+/dev/mapper/crypt_dev_$dev /mnt/iroot btrfs  noatime,subvolid=0,noauto  0 0
+EOF
+        fi
+        tu /etc/crypttab <<EOF
+crypt_dev_$dev  /dev/disk/by-id/$dev  /q/root/luks/host-treetowl  discard,luks
+EOF
+        if [[ ! -e /dev/mapper/crypt_dev_$dev ]]; then
+            cryptdisks_start crypt_dev_$dev
+        fi
+    done
+else
+    tu /etc/fstab <<'EOF'
+/q/i  /i  none  bind,noauto  0 0
+EOF
+fi
+
 exit $ret