fix bugs, support multiple distros via subvolumes
[automated-distro-installer] / arch-init
index a7420bedeeb09937041a3724ecfdc56ca3ccf166..aae184f99e3d31a4054cf2c0573767bea651bec6 100755 (executable)
--- a/arch-init
+++ b/arch-init
@@ -65,10 +65,10 @@ export swapn=2
 sed -ri '/^crypt_dev/d' /tmp/fai/crypttab
 mount -o subvol=root_$DISTRO /dev/mapper/crypt_dev_?da$rootn /mnt
 mkdir -p /mnt/{q,home}
-mount -o subvol=/q /dev/mapper/crypt_dev_?da$rootn /mnt/q
-mount -o subvol=/home_$DISTRO /dev/mapper/crypt_dev_?da$rootn /mnt/home
+mount -o subvol=q /dev/mapper/crypt_dev_?da$rootn /mnt/q
+mount -o subvol=home_$DISTRO /dev/mapper/crypt_dev_?da$rootn /mnt/home
 mkdir -p /mnt/boot
-mount /dev/?da$bootn /mnt/boot
+mount -o subvol=boot_$DISTRO /dev/?da$bootn /mnt/boot
 
 # https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption#Keyfiles
 cp /root/luks/host-$hostname /mnt/crypto_keyfile.bin
@@ -125,8 +125,6 @@ UUID=dd67766f-93c5-4ce3-9877-a1d9841dd4a4  none  swap  sw  0  0
 EOF
         ;;
     *)
-        echo "$0: 2nd fstab:"
-        cat /mnt/etc/fstab
         cp -r .ssh /mnt/root
         cp -r /root/distro-install-common /mnt/root
         ;;&
@@ -144,7 +142,7 @@ rm -f /mnt/etc/resolv.conf
 ln -s /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf
 
 # not necsesary, but makes reboot go fast.
-umount -R /mnt
+umount -R /mnt; sleep 1
 
 # causes 255 exit code, so doing this from the caller script.
 # reboot now