83 lines
3.0 KiB
Plaintext
83 lines
3.0 KiB
Plaintext
packages() {
|
|
if [ "$EFI" == "1" ]; then
|
|
addpkg grub-x86_64-efi efibootmgr
|
|
else
|
|
addpkg grub
|
|
fi
|
|
}
|
|
|
|
config() {
|
|
if [ "${ENC}" == "1" ]; then
|
|
if ! grep -q "GRUB_ENABLE_CRYPTODISK" /etc/default/grub; then
|
|
echo "GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
|
|
fi
|
|
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part${TARGET_PART})
|
|
if ! grep -q rd.luks.uuid /etc/default/grub; then
|
|
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.luks.uuid=${uuid} /" /etc/default/grub
|
|
fi
|
|
else
|
|
if ! grep -q "#GRUB_ENABLE_CRYPTODISK" /etc/default/grub; then
|
|
echo "#GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
|
|
fi
|
|
fi
|
|
|
|
|
|
if ! grep -q rd.lvm.vg /etc/default/grub; then
|
|
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.lvm.vg=vg_${TARGETNAME_UNDERSCORE} /" /etc/default/grub
|
|
fi
|
|
|
|
if ! [ "${KEY_LANG}" == "en" ]; then
|
|
if [ "${EFI}" == "1" ]; then
|
|
VGUUID=$(vgdisplay |grep UUID|awk '{print $3}')
|
|
LVUUID=$(lvdisplay "/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root" |grep UUID|awk '{print $3}')
|
|
rl=$(basename $(readlink "${TARGET_PHY_ID}-part${TARGET_PART}"))
|
|
TMP=$(lsblk -o NAME,UUID -l|grep "${rl}" | awk '{print $2}')
|
|
CRYPTUUID=${TMP//-/}
|
|
|
|
mkdir -p /boot/efi/EFI/void /boot/grub
|
|
grub-kbdcomp -o /boot/grub/${KEY_LANG}.gkb ${KEY_LANG}
|
|
tar cf /boot/grub/memdisk.tar /boot/grub/${KEY_LANG}.gkb
|
|
|
|
echo "set root=(memdisk)" > /boot/grub/early-grub.cfg
|
|
echo "set prefix=($root)/" >> /boot/grub/early-grub.cfg
|
|
echo "terminal_input at_keyboard" >> /boot/grub/early-grub.cfg
|
|
echo "keymap /boot/grub/${KEY_LANG}.gkb" >> /boot/grub/early-grub.cfg
|
|
echo "cryptomount -u ${CRYPTUUID}" >> /boot/grub/early-grub.cfg
|
|
echo "set root='lvmid/${VGUUID}/${LVUUID}'" >> /boot/grub/early-grub.cfg
|
|
#echo "set prefix=($root)/grub" >> /boot/grub/early-grub.cfg
|
|
echo "configfile grub.cfg" >> /boot/grub/early-grub.cfg
|
|
|
|
grub-mkimage -c /boot/grub/early-grub.cfg -o grubx64_de.efi -O x86_64-efi -m /boot/grub/memdisk.tar part_gpt cryptodisk luks gcry_rijndael gcry_rijndael gcry_sha256 lvm btrfs memdisk tar at_keyboard keylayouts configfile all_video
|
|
cp -f grubx64_de.efi /boot/efi/EFI/void/grubx64_de.efi
|
|
|
|
rm -rf grubx64_de.efi memdisk.tar
|
|
fi
|
|
if ! grep -q rd.console.keymap /etc/default/grub; then
|
|
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\" rd.vconsole.keymap=${L2} /" /etc/default/grub
|
|
fi
|
|
fi
|
|
|
|
|
|
uuid=$(blkid -o value -s UUID /dev/mapper/vg_${TARGETNAME_UNDERSCORE}-swap)
|
|
if [[ "${HIBERNATE}" == "1" ]]; then
|
|
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"resume=UUID=${uuid} /" /etc/default/grub
|
|
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=\"green/black\"" >> /etc/default/grub
|
|
fi
|
|
|
|
|
|
if [ "${EFI}" == "1" ]; then
|
|
grub-install --bootloader-id="Voidlinux"
|
|
efibootmgr --create --disk "${TARGET_PHY_ID}-part1" --loader /EFI/void/grubx64_de.efi --label "Voidlinux DE" --verbose
|
|
else
|
|
grub-install "${TARGET_PHY_ID}"
|
|
fi
|
|
lv=$(xbps-query linux|grep pkgver|awk '{print $2}')
|
|
lv1="${lv//-/}"
|
|
lv2="${lv1%_*}"
|
|
xbps-reconfigure -f "${lv2}"
|
|
}
|