summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-10-17 14:06:28 +0200
committerHolger Levsen <holger@layer-acht.org>2014-10-17 14:06:28 +0200
commit6bfe6f31dba1d2fa648eebf9c1218c5bd01744ad (patch)
tree23f6fca847460c7919c848e74f623e088f377c3f /bin
parentfa823e46ab653d2cacaf6aa7481f9a1917e789e1 (diff)
downloadjenkins.debian.net-6bfe6f31dba1d2fa648eebf9c1218c5bd01744ad.tar.xz
common-functions.sh: prevent running as root
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common-functions.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/common-functions.sh b/bin/common-functions.sh
index 45c16f0c..583d5b5c 100755
--- a/bin/common-functions.sh
+++ b/bin/common-functions.sh
@@ -11,6 +11,11 @@ common_cleanup(){
common_init() {
# check whether this script has been started from /tmp already
if [ "${0:0:5}" != "/tmp/" ] ; then
+ # check that we are not root
+ if [ $(id -u) -eq 0 ] ; then
+ echo "Do not run this as root."
+ exit 1
+ fi
# mktemp some place for us...
TTT=$(mktemp --tmpdir=/tmp jenkins-script-XXXXXXXX)
# prepare cleanup