From e218e91ad0ec6b660ca9ae7f3c45d5cde5a36fdf Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 8 Jan 2020 22:06:38 +0100 Subject: First version of luks encrypted archinstall. --- util/install_bootloader.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'util/install_bootloader.sh') diff --git a/util/install_bootloader.sh b/util/install_bootloader.sh index cf6c374..4d3e9b9 100644 --- a/util/install_bootloader.sh +++ b/util/install_bootloader.sh @@ -19,11 +19,32 @@ efi_partition_path=$1 +system_encryption=$2 + + +############ Add encryption setting in /etc/default/grub before calling grub-mkconfig +## to generate /boot/grub/grub.cfg + +## See: https://wiki.archlinux.org/index.php/Dm-crypt/System_configuration#Boot_loader mount $efi_partition_path /mnt grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \ --removable + +if [ $system_encryption == "yes" ];then + + cryptdevice_uuid=$(lsblk --fs | grep $main_partition_path | awk '{print $3}') + echo "cryptdevice_uuid: $cryptdevice_uuid" + old_kernel_param_line=$(cat /etc/default/grub | grep "GRUB_CMDLINE_LINUX_DEFAULT") + echo "old_kernel_param_line: $old_kernel_param_line" + new_kernal_param_line="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet cryptdevice=UUID=${cryptdevice_uuid}:main root=/dev/mapper/main\"" + echo "new_kernel_param_line: $new_kernal_param_line" + echo "Adding kernel parameters to /etc/default/grub" + sed -i "s|$old_kernel_param_line|$new_kernal_param_line|" /etc/default/grub + +fi + grub-mkconfig -o /boot/grub/grub.cfg umount $efi_partition_path -- cgit v1.2.3-70-g09d2