Elevate GRUB scripts

This commit is contained in:
Manuel Thalmann 2023-04-03 10:50:10 +02:00
parent f2de343c50
commit a970ec3915
2 changed files with 23 additions and 7 deletions

View file

@ -1,9 +1,15 @@
#!/bin/bash #!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null; pushd "${BASH_SOURCE%/*}" > /dev/null;
EFI_BOOT_DIR="${EFI_BOOT_DIR:-"/boot"}"; # Elevate script
BOOTLOADER_ID=${BOOTLOADER_ID:-"GRUB"}; if [ ! "$UID" -eq 0 ]
pacman --noconfirm -Syu grub efibootmgr; then
. ../../../Common/Config/GRUB/setup.sh; sudo bash "$BASH_SOURCE" "$USER";
else
EFI_BOOT_DIR="${EFI_BOOT_DIR:-"/boot"}";
BOOTLOADER_ID=${BOOTLOADER_ID:-"GRUB"};
pacman --noconfirm -Syu grub efibootmgr;
. ../../../Common/Config/GRUB/setup.sh;
fi;
popd > /dev/null; popd > /dev/null;

View file

@ -1,7 +1,17 @@
#!/bin/bash #!/bin/bash
EFI_BOOT_DIR="${EFI_BOOT_DIR}"; EFI_BOOT_DIR="${EFI_BOOT_DIR}";
BOOTLOADER_ID="${BOOTLOADER_ID}"; BOOTLOADER_ID="${BOOTLOADER_ID}";
grub-install --target=x86_64-efi --efi-directory="$EFI_BOOT_DIR" --bootloader-id="$BOOTLOADER_ID";
grub-mkconfig -o "$EFI_BOOT_DIR/grub/grub.cfg";
sed -i "s/#\(GRUB_DISABLE_OS_PROBER\)/\1/" /etc/default/grub # Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo
EFI_BOOT_DIR="${EFI_BOOT_DIR}" \
BOOTLOADER_ID="${BOOTLOADER_ID}" \
bash "$BASH_SOURCE" "$USER";
else
grub-install --target=x86_64-efi --efi-directory="$EFI_BOOT_DIR" --bootloader-id="$BOOTLOADER_ID";
grub-mkconfig -o "$EFI_BOOT_DIR/grub/grub.cfg";
sed -i "s/#\(GRUB_DISABLE_OS_PROBER\)/\1/" /etc/default/grub
fi;