From c216433ea64ffb763c60f5d6a3c83338916f68c9 Mon Sep 17 00:00:00 2001 From: Thorsten Date: Sat, 21 Dec 2024 21:09:44 +0100 Subject: [PATCH] new implementation for getting root permissions --- Boot to Windows.desktop | 6 +++--- boot-to-windows.sh | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Boot to Windows.desktop b/Boot to Windows.desktop index 4a5ca1e..5929e55 100755 --- a/Boot to Windows.desktop +++ b/Boot to Windows.desktop @@ -1,9 +1,9 @@ #!/usr/bin/env xdg-open [Desktop Entry] Categories=Utility;System; -Comment[de_DE]=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag -Comment=Bootet direkt nach Windows oder setzt den GRUB-Boot-Eintrag -Exec=pkexec /home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.sh +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 für den nächsten Start +Exec=/home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.sh GenericName[de_DE]= GenericName= Icon=/home/thorsten/Scripte/shell_boot-to-windows/boot-to-windows.png diff --git a/boot-to-windows.sh b/boot-to-windows.sh index 9860fda..7ee6bce 100755 --- a/boot-to-windows.sh +++ b/boot-to-windows.sh @@ -1,5 +1,11 @@ #!/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 if [[ -d "/boot/grub2" ]]; then GRUB_DIR="/boot/grub2"