small fixes. httpredir is not fast,and requires a noreuseconnection in apt cacher...
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index 64e09a246a071dc77bca86d4fd2960345b57d0a5..19438042a79c5baa9f5a171b89e62e7eee6b41ce 100755 (executable)
@@ -30,8 +30,7 @@ skiptask partition ||: # for running out of fai
 devs=(${letters[@]/#//dev/${d}})
 crypt_devs=(${letters[@]/#//dev/mapper/crypt_dev_${d}})
 
-# we can set this manually to force partitioning
-#partition=false
+partition=false
 
 # somewhat crude detection of whether to partition
 for dev in ${devs[@]}; do
@@ -46,7 +45,7 @@ for dev in ${devs[@]}; do
     done
 done
 
-partition=true # override temporarily
+#partition=true # for temporarily override
 
 # keyfiles generated like:
 # head -c 2048 /dev/urandom | od | s dd of=/q/root/luks/host-demohost
@@ -74,6 +73,11 @@ create_subvols() {
     for x in q home root; do
         btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x
     done
+    for x in root/a q/a; do
+        mkdir -p $x
+        chown 1000:1000 $x
+        chmod 755 $x
+    done
     btrfs subvolume set-default \
           $(btrfs subvolume list . | grep 'root$' | awk '{print $2}') .
     chattr -Rf +C root
@@ -86,6 +90,8 @@ shopt -s nullglob
 if $partition; then
     for dev in ${devs[@]}; do
         for x in $dev[0-9]; do wipefs -a $x; done
+    done
+    for dev in ${devs[@]}; do
         parted -s $dev mklabel gpt
         # gpt ubuntu cloud image uses ~4. fai uses 1 MiB. ehh, i'll do 4.
         # also, using MB instead of MiB causes complains about alignment.
@@ -152,6 +158,7 @@ fi
 cat > /tmp/fai/fstab <<EOF
 $crypt  /  btrfs  noatime,subvol=/root  0 0
 $crypt  /q  btrfs  noatime,subvol=/q  0 0
+/q/a  /a  none  bind  0 0
 $crypt  /home  btrfs  noatime,subvol=/home  0 0
 ${devs[0]}1  /boot  ext4  noatime  0 2
 EOF