Commit 3b6b9eab85b0b463c783d3e605df99d9ea1b4b1b

Authored by Prince Mbekwa
1 parent 28b6e81c

added check for root priviledges

Commited by: Prince Mbekwa
Showing 1 changed file with 18 additions and 1 deletions
dmsctl.sh
... ... @@ -16,13 +16,30 @@ INSTALL_PATH=`pwd`
16 16 JAVABIN=/usr/bin/java
17 17 ZEND_DIR=/usr/local/zend
18 18  
  19 +# exits if the UID is not 0 [root]
  20 +check_root_privileges()
  21 +{
  22 + ID="id -u"
  23 + MYUID=`$ID 2> /dev/null`
  24 + if [ ! -z "$MYUID" ]; then
  25 + if [ $MYUID != 0 ]; then
  26 + echo "You need root privileges to run this script!";
  27 + exit 1
  28 + fi
  29 + else
  30 + echo "Could not detect UID";
  31 + exit 1
  32 + fi
  33 +}
  34 +
  35 +
19 36 if [ -f /etc/zce.rc ];then
20 37 . /etc/zce.rc
21 38 else
22 39 echo "/etc/zce.rc doesn't exist!"
23 40 exit 1;
24 41 fi
25   -
  42 +check_root_privileges
26 43  
27 44 # OpenOffice
28 45 SOFFICEFILE=soffice
... ...