aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorziggys <ziggys@autistici.org>2018-05-20 21:38:21 -0300
committerziggys <ziggys@autistici.org>2018-05-20 21:38:21 -0300
commite950dc73c75511fc7c54fdb07e987ab2dd74aa7e (patch)
tree3c990550f7f1099458c4846204ad371c69ef0071
parent60afa4f42e1a60fa7b80a5846a48f85d81141bbd (diff)
downloadpupm-e950dc73c75511fc7c54fdb07e987ab2dd74aa7e.tar
pupm-e950dc73c75511fc7c54fdb07e987ab2dd74aa7e.zip
Define default for empty vars - 3.0.1
-rw-r--r--README.txt2
-rw-r--r--pupm.config17
-rwxr-xr-xpupm.sh10
3 files changed, 17 insertions, 12 deletions
diff --git a/README.txt b/README.txt
index 259cdfb..91a39c9 100644
--- a/README.txt
+++ b/README.txt
@@ -24,6 +24,6 @@ STDOUT and STDERR will be logged in '/tmp/pupm.log'. Cronjob can be configued
easyly. Use '/tmp/pupm.log' as inputfile for sending notifications with
appropiate tools.
+
# TODO
# check syntax
-# define default for empty vars
diff --git a/pupm.config b/pupm.config
index b6668c9..a08389e 100644
--- a/pupm.config
+++ b/pupm.config
@@ -1,13 +1,10 @@
-#pupm configuration file
-#use to define script variables
-#empty variables will be treated
-#as default for script
-#run ./pupm.sh -h for help
-#and variables choices
+# pupm configuration file
+# use it to define script variables
+# empty ones will fall to these default
-MODULESPATH=
-DIROWNER=root
-DIRGROUP=prosody
-DIRPERMISSIONS=750
+MODULESPATH=/usr/lib/prosody/modules
+OWNER=root
+GROUP=prosody
+PERMISSIONS=750
RELOAD=no
SYSTEMINIT=service
diff --git a/pupm.sh b/pupm.sh
index 1e91039..6466389 100755
--- a/pupm.sh
+++ b/pupm.sh
@@ -6,7 +6,7 @@
# License BSD 2.0 (3-Clause)
# scriptinfo
-VERSION='3.0.0' # Make it simpler - 3.0.0
+VERSION='3.0.1' # Define default value for empty vars
AUTHOR="ziggys"
CYEAR=$(date +%Y)
COPYRIGHT="${CYEAR} by ${AUHTOR}"
@@ -72,6 +72,14 @@ PERMISSIONS=$(sed '/PERMISSIONS=/ !d; s/PERMISSIONS=//' ${INPUT})
RELOAD=$(sed '/RELOAD=/ !d; s/RELOAD=//' ${INPUT})
SYSTEMINIT=$(sed '/SYSTEMINIT=/ !d; s/SYSTEMINIT=//' ${INPUT})
+# difoult valius for variabels
+: ${MODULESPATH:=/usr/lib/prosody/modules}
+: ${ONWER:=root}
+: ${GROUP:=prosody}
+: ${PERMISSIONS:=750}
+: ${RELOAD:=no}
+: ${SYSTEMINIT:=service}
+
# variabels tu ius ololon
DATE=$(date "+%d-%m %H:%M")
HGDIR=".hg"