diff --git a/scripts/Arch/Software/GRUB/install.sh b/scripts/Arch/Software/GRUB/install.sh index 1e4e3679..2cac3611 100755 --- a/scripts/Arch/Software/GRUB/install.sh +++ b/scripts/Arch/Software/GRUB/install.sh @@ -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; diff --git a/scripts/Common/Config/GRUB/setup.sh b/scripts/Common/Config/GRUB/setup.sh index d40d222b..a2ee3571 100644 --- a/scripts/Common/Config/GRUB/setup.sh +++ b/scripts/Common/Config/GRUB/setup.sh @@ -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;