X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=arch-init-chroot;fp=arch-init-chroot;h=d2e0f976716b83e93adb7bfce95773836a1d6150;hb=81e0e0b826ebffdee7d809ee4dff1338af7692e1;hp=6c9d66b673b0fa5f4526e141788364aab712ec1c;hpb=4c0b3d508093cd1561f6ae887f154f06383b67d3;p=automated-distro-installer diff --git a/arch-init-chroot b/arch-init-chroot index 6c9d66b..d2e0f97 100755 --- a/arch-init-chroot +++ b/arch-init-chroot @@ -55,50 +55,28 @@ cat /etc/fstab # which will be the crypt device name under /dev/mapper/ # https://wiki.archlinux.org/index.php/GRUB#Additional_arguments -first_boot_dev=${BOOT_DEVICE%% *} -crypt_dev=${first_boot_dev}$rootn -crypt_name=$(/root/devbyid $crypt_dev) -crypt_name=crypt_dev_${crypt_name##*/} + +root_devs=( ${ROOT_PARTITIONS} ) +first_root_dev=${root_devs[0]} k_args=( - cryptdevice=$crypt_dev:$crypt_name:allow-discards - root=/dev/mapper/$crypt_name - resume=${crypt_dev%[0-9]}$swapn + cryptdevices=${ROOT_PARTITIONS// /,} + root=/dev/mapper/crypt_dev_${first_root_dev##*/} + resume=${first_root_dev%[0-9]}$swapn ) -crypt_mapper_devs=(/dev/mapper/crypt_dev_*$rootn) -crypt_count=${#crypt_mapper_devs[@]} -if [[ crypt_count == 0 ]]; then - echo "$0: error: expected crypt_mapper_devs length to be > 0" - ls -la /dev/mapper - exit 1 -fi -keyfile_vars=() -dup_keys=() extra_encrypt_hooks=() # If we have more than 1 to decrypt, arch wiki lead me onto # a sort of hacky way run the encrypt hook multiple times. -for ((i=1; i < $crypt_count; i++)); do - extra_encrypt_hooks+=(encrypt$i) - if (( i = 1 )); then dup_keys=(" "); fi # prefix with an empty space - cp /crypto_keyfile.bin /crypto_keyfile$i.bin - dup_keys+=(/crypto_keyfile$i.bin) - base=/usr/lib/initcpio - cp $base/hooks/encrypt{,$i} - cp $base/install/encrypt{,$i} - sed -i "s/cryptdevice/cryptdevice$i/" $base/hooks/encrypt$i - sed -i "s/cryptkey/cryptkey$i/" $base/hooks/encrypt$i - crypt_name=${crypt_mapper_devs[i]#/dev/mapper/} - crypt_dev=/dev/${crypt_name#crypt_dev_} - k_args+=(cryptdevice$i=$crypt_dev:$crypt_name:allow-discards - cryptkey$i=rootfs:/crypto_keyfile$i.bin) -done + +base=/usr/lib/initcpio + # https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Configuring_mkinitcpio_2 # used to have lvm2 after encrypt for lvm, but not using lvm anymore -for x in encrypt ${extra_encrypt_hooks[@]} btrfs; do +for x in encrypt btrfs; do sed -ri -f - /etc/mkinitcpio.conf <