fixes mostly for stable
[automated-distro-installer] / arch-init-chroot
index 53a2b944f72ad2583e8d16f0aa9500f4f8633d21..9c3fc48067a16b3e72ec5dc920a0da1f7353337a 100755 (executable)
@@ -3,6 +3,9 @@ set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
 
 for x in /etc/*.pacorig; do
+    # This started breaking immediately when I stoped doing genfstab.
+    # It's probably not needed anymore
+    [[ -e $x ]] || break
     mv $x ${x%.pacorig}
 done
 
@@ -56,14 +59,14 @@ if [[ $hostname == x2 || $hostname == demohost ]]; then
     # but, if you are using your own fstab, it seems you just give it a name,
     # which will be the crypt device name under /dev/mapper/
     # https://wiki.archlinux.org/index.php/GRUB#Additional_arguments
-    crypt_dev=(/dev/?da3)
+    crypt_dev=(/dev/?da$rootn)
     crypt_name=crypt_dev_${crypt_dev##/dev/}
     k_args=(
         cryptdevice=$crypt_dev:$crypt_name:allow-discards
         root=/dev/mapper/$crypt_name
-        resume=${crypt_dev%3}2
+        resume=${crypt_dev%[0-9]}$swapn
     )
-    crypt_mapper_devs=(/dev/mapper/crypt_dev_?d[a-z]3)
+    crypt_mapper_devs=(/dev/mapper/crypt_dev_?d[a-z]$rootn)
     keyfile_vars=()
     for ((i=1; i < ${#crypt_mapper_devs[@]}; i++)); do
         ((i!=1)) || dup_keys=(" ")