diff --git a/install_arch b/install_arch index ae92459..0655071 100755 --- a/install_arch +++ b/install_arch @@ -5,8 +5,14 @@ function main read -P 'Timezone: ' -l timezone read -P 'Hostname: ' -l new_host_name read -P 'Network interface: ' -l net_interface - read -P 'Is your disk encrypted? (y/N) ' -l is_encrypt read -P 'Username: ' -l username + read -P 'Is your disk encrypted? (y/N) ' -l is_encrypt + + set -l encrypted_uuid '' + if test "$is_encrypt" = 'y'; or test "$is_encrypt" = 'Y' + read -P 'Encrypted device UUID: ' encrypted_uuid + end + read -P 'Boot mode (bios/uefi): ' -l boot_mode read -P 'Grub target: ' -l device @@ -28,7 +34,7 @@ function main create_admin_user $username - install_grub $boot_mode $device + install_grub $boot_mode $device $encrypted_uuid install_openssh end @@ -116,7 +122,7 @@ function create_admin_user -a username gpasswd -a $username sudo end -function install_grub -a boot_mode target +function install_grub -a boot_mode target encrypted_uuid log "Installing grub to target $target" switch $boot_mode @@ -128,6 +134,10 @@ function install_grub -a boot_mode target grub-install --target=x86_64-efi --efi-directory=$target --bootloader-id=GRUB end + if test -n "$encrypted_uuid" + sed -i "s/loglevel=3 quiet/loglevel=3 quiet cryptdevice=UUID=$encrypted_uuid:cryptlvm/" /etc/default/grub + end + grub-mkconfig -o /boot/grub/grub.cfg end