mirror of
https://github.com/nix-community/disko.git
synced 2024-09-11 06:25:33 +03:00
disko-install: check if it runs as root
This commit is contained in:
parent
5d2d3e421a
commit
a6717b1afe
@ -90,7 +90,6 @@ parseArgs() {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
mode=$2
|
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--extra-files)
|
--extra-files)
|
||||||
@ -155,6 +154,12 @@ main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then
|
||||||
flake="${BASH_REMATCH[1]}"
|
flake="${BASH_REMATCH[1]}"
|
||||||
flakeAttr="${BASH_REMATCH[2]}"
|
flakeAttr="${BASH_REMATCH[2]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user