aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorziggys <ziggys@autistici.org>2018-05-07 21:58:32 -0300
committerziggys <ziggys@autistici.org>2018-05-07 21:58:32 -0300
commitda4ea7afb0ac16614eb7c105972fcf0f8bebba29 (patch)
tree3037d541d87cf66e5d7047f245efbb861525a873
parentecf57872ad4fbf6cff56d88db1d7f36611d091ff (diff)
downloadpupm-da4ea7afb0ac16614eb7c105972fcf0f8bebba29.tar
pupm-da4ea7afb0ac16614eb7c105972fcf0f8bebba29.zip
Parse variables from commandline - 2.0.2
-rwxr-xr-xpupm.sh28
1 files changed, 9 insertions, 19 deletions
diff --git a/pupm.sh b/pupm.sh
index ceae061..843da55 100755
--- a/pupm.sh
+++ b/pupm.sh
@@ -99,7 +99,6 @@ SYSTEMINIT=`cat ${INPUTFILE} | grep "SYSTEMINIT=" | sed 's/SYSTEMINIT=//g; s/ *$
: ${SYSTEMINIT:=service}
# general variables
-REALOWNER=`ls -ld ${MODULESPATH} | awk '{ print $3 }'`
DATE=`date +%d.%m.%Y`
TIME=`date +%H:%M`
@@ -126,27 +125,18 @@ shift $(($OPTIND -1))
# clean log and relog date
echo "${DATE} - ${TIME}" > /tmp/pupm.log
-# update
-if [ -d ${MODULESPATH} ]; then
- if [ ${REALOWNER} = ${DIROWNER} ]; then
- cd ${MODULESPATH}
- hg pull --update >> /tmp/pupm.log 2>&1
-
- else
- echo "You have no permissions to update the repository modules" >> /tmp/pupm.log 2>&1
- exit $?
-
- fi
-
-else
- echo "The directory ${MODULESPATH} does not exist" >> /tmp/pupm.log 2>&1
-
-fi
-
+REALOWNER=`ls -ld ${MODULESPATH} | awk '{ print $3 }'`
+# checks
+test -d ${MODULESPATH} && echo "exists" || echo "no dir"
+echo $MODULESPATH
+cd ${MODULESPATH}
+test ${REALOWNER} = ${DIROWNER} && echo "ok" || echo "no permissions"
+ISMPHG=`hg pull --update | echo $?`
+test ${ISMPHG} -lt 1 && hg pull --update || echo "no es hg"
+
# change permissions
chown ${DIROWNER}:${DIRGROUP} -R ${MODULESPATH} >> /tmp/pupm.log 2>&1
chmod ${DIRPERMISSIONS} -R ${MODULESPATH} >> /tmp/pupm.log 2>&1
-
# reload or restart
case ${RELOAD} in
yes) prosodyctl reload >> /tmp/pupm.log 2>&1;;