disko-install: check if it runs as root

This commit is contained in:
Jörg Thalheim 2024-03-26 15:10:58 +01:00 committed by mergify[bot]
parent 5d2d3e421a
commit a6717b1afe

View file

@ -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]}"