From 7d162f8ade2d7ff22c196f03b1788ce0296a2196 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 7 Apr 2022 02:52:08 -0500 Subject: [PATCH] Require to run with sudo. --- tools/aws-grub-setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/aws-grub-setup.sh b/tools/aws-grub-setup.sh index 712423f..36e4291 100644 --- a/tools/aws-grub-setup.sh +++ b/tools/aws-grub-setup.sh @@ -18,6 +18,13 @@ while [ $secs -gt 0 ]; do done } +# Check if user is root +if [ $(id -u) = 0 ]; then + echo "Please don't run with root or sudo privileges! + > We'll request them when necessary." + exit 1 +fi + TMP_DIR="$(mktemp -d)" KERNEL_LOG="$TMP_DIR/kernel_log" GRUB_FILE="/etc/default/grub"