aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorziggys <ziggys@autistici.org>2018-06-10 17:41:51 -0400
committerziggys <ziggys@autistici.org>2018-06-10 17:41:51 -0400
commit7a6bcc68d20574c09649c2d326a977f63b634602 (patch)
treeed6c5e821acd9b2da0095c189f9a76e748b9ec4b
parent0b65462c3bcb1b5f318c6f7e98154cb34b8063a1 (diff)
downloadpupm-7a6bcc68d20574c09649c2d326a977f63b634602.tar
pupm-7a6bcc68d20574c09649c2d326a977f63b634602.zip
Check some sytax and fix minor bugs
-rwxr-xr-xpupm.sh24
1 files changed, 10 insertions, 14 deletions
diff --git a/pupm.sh b/pupm.sh
index 34602e9..ca55a1c 100755
--- a/pupm.sh
+++ b/pupm.sh
@@ -8,14 +8,12 @@
# scriptinfo
VERSION='3.0.2' # Check some sintax and fix minor bugs
AUTHOR="ziggys"
-CYEAR=$(date +%Y)
-COPYRIGHT="${CYEAR} by ${AUHTOR}"
# usash
show_help () {
test "${#}" = 0 || echo "${@}"
echo "${0##*/} version ${VERSION}"
-echo " Copyright (C) ${COPYRIGHT}"
+echo " Copyright (C) 2018 by ${AUTHOR}"
echo
echo "${0##*/} comes with ABSOLUTELY NO WARRANTY. This is free software, and you"
echo " are welcome to redistribute it under certain conditions. See the BSD 2.0"
@@ -41,7 +39,7 @@ update () {
cd "${MODULESPATH}" || return 2
test ! -d "${HGDIR}" \
- && printf "abort: no repository found in %s\\n" "${MODULESPAHT}" >> "${PUPMLOG}" \
+ && printf "abort: no repository found in %s\\n" "${MODULESPATH}" >> "${PUPMLOG}" \
&& exit 2 \
|| hg pull --update >> "${PUPMLOG}" 2>&1
@@ -62,7 +60,7 @@ service_restart () {
# variabels dat comz from config
CONFIG="${1}"
-test -z "${CONFIG}" && show_help
+test -z "${CONFIG}" && show_help "${@}"
INPUT="$(mktemp)"
sed '/^#/ d; s/;[ \t].*//g; s/;$//g; s/[ \t]*$//g' "${CONFIG}" > "${INPUT}"
@@ -74,13 +72,13 @@ RELOAD="$(sed '/RELOAD=/ !d; s/RELOAD=//' "${INPUT}")"
SYSTEMINIT="$(sed '/SYSTEMINIT=/ !d; s/SYSTEMINIT=//' "${INPUT}")"
VERBOSE="$(sed '/VERBOSE=/ !d; s/VERBOSE=//' "${INPUT}")"
# difoult valius for variabels
-: ${MODULESPATH:=/usr/lib/prosody/modules}
-: ${ONWER:=root}
-: ${GROUP:=prosody}
-: ${PERMISSIONS:=750}
-: ${RELOAD:=no}
-: ${SYSTEMINIT:=service}
-: ${VERBOSE:=yes}
+: "${MODULESPATH:=/usr/lib/prosody/modules}"
+: "${ONWER:=root}"
+: "${GROUP:=prosody}"
+: "${PERMISSIONS:=750}"
+: "${RELOAD:=no}"
+: "${SYSTEMINIT:=service}"
+: "${VERBOSE:=yes}"
# variabels tu ius ololon
DATE="$(date "+%d-%m %H:%M")"
@@ -88,8 +86,6 @@ HGDIR=".hg"
PUPMLOG="$(mktemp)"
# inizial comandz
-test "${#}" -lt 1 && show_help
-
printf "%s\\n" "${DATE}" > "${PUPMLOG}"
test -d "${MODULESPATH}" || printf "%s is not a directory" "${MODULESPATH}" >> "${PUPMLOG}"