summaryrefslogtreecommitdiff
path: root/hack/check_root.sh
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-07-21 13:30:07 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-07-21 13:31:43 +0200
commitd628de31d71b1849fdb102f8689faa80fe286b83 (patch)
treee19bb1e811fbf4303895798f582f71dea2e5bdf2 /hack/check_root.sh
parentdf6920aa79073b2767d24c6524367384b6284b31 (diff)
downloadpodman-d628de31d71b1849fdb102f8689faa80fe286b83.tar.gz
podman-d628de31d71b1849fdb102f8689faa80fe286b83.tar.bz2
podman-d628de31d71b1849fdb102f8689faa80fe286b83.zip
unit tests: root check
The unit tests currently require running as root. This has caused some confusion that justifies adding a root check to `make localunit` and error out for non-root users instead of starting the tests deemed to fail. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'hack/check_root.sh')
-rwxr-xr-xhack/check_root.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/hack/check_root.sh b/hack/check_root.sh
new file mode 100755
index 000000000..203eae9d3
--- /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