PortValhalla/scripts/Common/Config/GRUB/setup.sh

24 lines
657 B
Bash
Raw Normal View History

2023-04-01 11:01:04 +00:00
#!/bin/bash
EFI_BOOT_DIR="${EFI_BOOT_DIR}";
BOOTLOADER_ID="${BOOTLOADER_ID}";
2023-04-01 13:17:26 +00:00
2023-04-03 08:50:10 +00:00
# Elevate script
if [ ! "$UID" -eq 0 ]
then
2023-07-13 21:10:31 +00:00
sudo \
2023-04-03 08:50:10 +00:00
EFI_BOOT_DIR="${EFI_BOOT_DIR}" \
BOOTLOADER_ID="${BOOTLOADER_ID}" \
2024-03-09 11:23:26 +00:00
bash "$BASH_SOURCE";
2023-04-03 08:50:10 +00:00
else
2024-03-09 14:01:15 +00:00
sed -i \
-e "s/#\(GRUB_DISABLE_OS_PROBER\)/\1/" \
2024-03-10 03:31:06 +00:00
`#-e "/^GRUB_CMDLINE_LINUX_DEFAULT=/{"` \
`#-e "h; s/^/#/; p;"` \
`#-e "g; s/loglevel=3 quiet//"` \
`#-e "}"` \
2024-03-09 14:01:15 +00:00
/etc/default/grub;
2023-04-03 08:50:10 +00:00
grub-install --target=x86_64-efi --efi-directory="$EFI_BOOT_DIR" --bootloader-id="$BOOTLOADER_ID";
grub-mkconfig -o "$EFI_BOOT_DIR/grub/grub.cfg";
fi;