diff --git a/Makefile b/Makefile index 71b4772c43..132dde9394 100644 --- a/Makefile +++ b/Makefile @@ -307,6 +307,7 @@ testunit: libpodimage ## Run unittest on the built image .PHONY: localunit localunit: test/goecho/goecho varlink_generate + hack/check_root.sh make localunit ginkgo \ -r \ $(TESTFLAGS) \ diff --git a/hack/check_root.sh b/hack/check_root.sh new file mode 100755 index 0000000000..203eae9d36 --- /dev/null +++ b/hack/check_root.sh @@ -0,0 +1,5 @@ +#!/bin/bash +if ! [ $(id -u) = 0 ]; then + echo "Please run as root! '$@' requires root privileges." + exit 1 +fi