lots: shellcheck, streaming stuff, fixes
[distro-setup] / iboot
diff --git a/iboot b/iboot
index 78805bfa189dc7c9cdd8732a5bbb6fa750c021d6..96ccdb227b0d4d7910bfbd7ee8b348aa459759ca 100644 (file)
--- a/iboot
+++ b/iboot
@@ -1,6 +1,7 @@
 #!/bin/bash
 
-[[ $EUID == 0 ]] || exec sudo -E "$script" "$@"
+## in development, meant to be run manually
+[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
 
 if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
 shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
@@ -9,16 +10,19 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${P
 
 set -x
 
+da=(/dev/mapper/crypt_dev*)
+d=${da[0]}
 
-boot_part=$(awk '$2 == "/boot" {print $1}' /etc/mtab)
-boot_dev=${boot_part%[0-9]*}
-# from partition.DEFAULT
-new_boot_part=${boot_dev}4
-mount -o subvol=debianbuster_bootstrap $new_boot_part /mnt
+mount -o subvol=root_trisquelnabia $d /mnt
+
+boot_part=$(awk '$2 == "/" {print $1}' /etc/mtab)
+mount -o subvol=boot_trisquelnabia $boot_part /mnt/boot
 
 cd /mnt
 mount -o bind /dev dev
 mount -o bind /proc proc
 mount -o bind /sys sys
 mkdir -p boot/efi
-mount $(awk '$2 == "/boot/efi" {print $1}' /etc/mtab) boot/efi
+mount "$(awk '$2 == "/boot/efi" {print $1}' /etc/mtab)" boot/efi
+chroot .
+# then run zboot-chroot