small fix

This commit is contained in:
teldra 2021-03-12 21:55:45 +01:00
parent 6331088d8a
commit b5c8fbd0e5
1 changed files with 8 additions and 4 deletions

View File

@ -3,20 +3,24 @@ module start "bootloader" "Install Bootloader"
source "${vars}/disk"
diskid="${cfg[diskid]//-/_}"
if [[ ! "${cfg[fde_key_store]}" == "none" ]] && [[ ! "${cfg[fde_key_store]}" == "once" ]]; then
if ! grep -q "GRUB_ENABLE_CRYPTODISK" "${dest}"/etc/default/grub; then
echo "GRUB_ENABLE_CRYPTODISK=y" >> "${dest}"/etc/default/grub
if [[ ! "${cfg[fde_key_store]}" == "none" ]]; then
if [[ ! "${cfg[fde_key_store]}" == "once" ]]; then
if ! grep -q "GRUB_ENABLE_CRYPTODISK" "${dest}"/etc/default/grub; then
echo "GRUB_ENABLE_CRYPTODISK=y" >> "${dest}"/etc/default/grub
fi
fi
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.luks.uuid=${cfg[partuuid]} /" "${dest}"/etc/default/grub
if [[ ! -f "${dest}"/boot/volume.key ]] && [[ ! "${cfg[fde_key_store]}" == "twice" ]]; then
dd bs=1 count=64 if=/dev/urandom of="${dest}"/boot/volume.key
echo -n "${cfg[diskpw]}" | cryptsetup luksAddKey "${cfg[diskname]}${cfg[target_part]}" "${dest}"/boot/volume.key -d -
chmod 000 "${dest}"/boot/volume.key
chmod -R g-rwx,o-rwx "${dest}"/boot
fi
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.luks.uuid=${cfg[partuuid]} /" "${dest}"/etc/default/grub
fi
if ! grep -q rd.lvm.vg "${dest}"/etc/default/grub; then
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.lvm.vg=voidvg.${diskid} /" "${dest}"/etc/default/grub
fi