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

24 lines
657 B
Bash
Executable file

#!/bin/bash
EFI_BOOT_DIR="${EFI_BOOT_DIR}";
BOOTLOADER_ID="${BOOTLOADER_ID}";
# Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo \
EFI_BOOT_DIR="${EFI_BOOT_DIR}" \
BOOTLOADER_ID="${BOOTLOADER_ID}" \
bash "$BASH_SOURCE";
else
sed -i \
-e "s/#\(GRUB_DISABLE_OS_PROBER\)/\1/" \
`#-e "/^GRUB_CMDLINE_LINUX_DEFAULT=/{"` \
`#-e "h; s/^/#/; p;"` \
`#-e "g; s/loglevel=3 quiet//"` \
`#-e "}"` \
/etc/default/grub;
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;