From 3b6b9eab85b0b463c783d3e605df99d9ea1b4b1b Mon Sep 17 00:00:00 2001 From: Prince Mbekwa Date: Thu, 26 Nov 2009 14:11:36 +0200 Subject: [PATCH] added check for root priviledges --- dmsctl.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dmsctl.sh b/dmsctl.sh index fbe83db..70ef294 100755 --- a/dmsctl.sh +++ b/dmsctl.sh @@ -16,13 +16,30 @@ INSTALL_PATH=`pwd` JAVABIN=/usr/bin/java ZEND_DIR=/usr/local/zend +# exits if the UID is not 0 [root] +check_root_privileges() +{ + ID="id -u" + MYUID=`$ID 2> /dev/null` + if [ ! -z "$MYUID" ]; then + if [ $MYUID != 0 ]; then + echo "You need root privileges to run this script!"; + exit 1 + fi + else + echo "Could not detect UID"; + exit 1 + fi +} + + if [ -f /etc/zce.rc ];then . /etc/zce.rc else echo "/etc/zce.rc doesn't exist!" exit 1; fi - +check_root_privileges # OpenOffice SOFFICEFILE=soffice -- libgit2 0.21.4