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
pushd "${BASH_SOURCE%/*}" > /dev/null;
EFI_BOOT_DIR="${EFI_BOOT_DIR:-"/boot"}";
BOOTLOADER_ID=${BOOTLOADER_ID:-"GRUB"};
pacman --noconfirm -Syu grub efibootmgr;
. ../../../Common/Config/GRUB/setup.sh;
# Elevate script
if [ ! "$UID" -eq 0 ]
then
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;

View file

@ -1,7 +1,17 @@
#!/bin/bash
EFI_BOOT_DIR="${EFI_BOOT_DIR}";
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;