void-bash-installer/step3/30-bootloader
2021-05-12 11:36:03 +02:00

47 lines
1.7 KiB
Plaintext

module start "bootloader" "Install Bootloader"
diskid="${cfg[diskid]//-/_}"
if [[ ! "${cfg[fde_key_store]}" == "none" ]]; then
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.luks.uuid=${cfg[partuuid]} /" /etc/default/grub
if [[ ! "${cfg[fde_key_store]}" == "once" ]]; then
if ! grep -q "GRUB_ENABLE_CRYPTODISK" /etc/default/grub; then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
fi
fi
if [[ ! -f /boot/volume.key ]] && [[ ! "${cfg[fde_key_store]}" == "twice" ]] && [[ ! "${cfg[fde_key_store]}" == "once" ]]; then
dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
echo -n "${cfg[diskpw]}" | cryptsetup luksAddKey "${cfg[diskname]}${cfg[target_part]}" /boot/volume.key -d -
chmod 000 /boot/volume.key
chmod -R g-rwx,o-rwx /boot
fi
fi
if ! grep -q rd.lvm.vg /etc/default/grub; then
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.lvm.vg=voidvg.${diskid} /" /etc/default/grub
fi
if ! grep -q rd.console.keymap /etc/default/grub; then
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\" rd.vconsole.keymap=${cfg[lang_console]} /" /etc/default/grub
fi
if [[ "${cfg[hibernate]}" == "1" ]]; then
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"resume=UUID=${cfg[swapuuid]} /" /etc/default/grub
fi
if [[ "${cfg[fde_key_store]}" == "initramfs" ]]; then
mkdir -p /etc/dracut.conf.d/
echo 'install_items+=" /boot/volume.key /etc/crypttab "' > /etc/dracut.conf.d/crypt-ssh.conf
echo "voidluks-${diskid} UUID=${cfg[partuuid]} /boot/volume.key luks" > /etc/crypttab
fi
if ! grep -q "dark-gray/black" /etc/default/grub; then
echo "GRUB_COLOR_NORMAL=\"dark-gray/black\"" >> /etc/default/grub
echo "GRUB_COLOR_HIGHLIGHT=\"light-red/black\"" >> /etc/default/grub
fi
module end