Add kernel params for encrypted lvm

This commit is contained in:
mitchell 2020-11-15 14:31:58 -05:00
parent 9a76c74ed2
commit ffb92e926e
1 changed files with 13 additions and 3 deletions

View File

@ -5,8 +5,14 @@ function main
read -P 'Timezone: ' -l timezone read -P 'Timezone: ' -l timezone
read -P 'Hostname: ' -l new_host_name read -P 'Hostname: ' -l new_host_name
read -P 'Network interface: ' -l net_interface 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 '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 'Boot mode (bios/uefi): ' -l boot_mode
read -P 'Grub target: ' -l device read -P 'Grub target: ' -l device
@ -28,7 +34,7 @@ function main
create_admin_user $username create_admin_user $username
install_grub $boot_mode $device install_grub $boot_mode $device $encrypted_uuid
install_openssh install_openssh
end end
@ -116,7 +122,7 @@ function create_admin_user -a username
gpasswd -a $username sudo gpasswd -a $username sudo
end end
function install_grub -a boot_mode target function install_grub -a boot_mode target encrypted_uuid
log "Installing grub to target $target" log "Installing grub to target $target"
switch $boot_mode 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 grub-install --target=x86_64-efi --efi-directory=$target --bootloader-id=GRUB
end 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 grub-mkconfig -o /boot/grub/grub.cfg
end end