new implementation for getting root permissions

This commit is contained in:
2024-12-21 21:09:44 +01:00
parent 015e0a03de
commit c216433ea6
2 changed files with 9 additions and 3 deletions

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env xdg-open #!/usr/bin/env xdg-open
[Desktop Entry] [Desktop Entry]
Categories=Utility;System; Categories=Utility;System;
Comment[de_DE]=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag Comment[de_DE]=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag für den nächsten Start
Comment=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag Comment=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag für den nächsten Start
Exec=pkexec /home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.sh Exec=/home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.sh
GenericName[de_DE]= GenericName[de_DE]=
GenericName= GenericName=
Icon=/home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.png Icon=/home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.png

View File

@@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
# Überprüfen, ob das Skript mit Root-Rechten läuft
if [ "$EUID" -ne 0 ]; then
# Root Rechte anfordern und neu starten
exec sudo "$0" "$@"
fi
# Ermitteln, ob grub oder grub2 verwendet wird # Ermitteln, ob grub oder grub2 verwendet wird
if [[ -d "/boot/grub2" ]]; then if [[ -d "/boot/grub2" ]]; then
GRUB_DIR="/boot/grub2" GRUB_DIR="/boot/grub2"