From a6717b1afee7ae955c61eefdf0ce8f864ef78115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 26 Mar 2024 15:10:58 +0100 Subject: [PATCH] disko-install: check if it runs as root --- disko-install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/disko-install b/disko-install index 55fa50a..21c1803 100755 --- a/disko-install +++ b/disko-install @@ -90,7 +90,6 @@ parseArgs() { exit 1 ;; esac - mode=$2 shift ;; --extra-files) @@ -155,6 +154,12 @@ main() { exit 1 fi + # check if we are root + if [[ "$EUID" -ne 0 ]]; then + echo "This script must be run as root" >&2 + exit 1 + fi + if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then flake="${BASH_REMATCH[1]}" flakeAttr="${BASH_REMATCH[2]}"