aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2017-02-18 01:32:01 +0100
committerSebastian Pipping <sebastian@pipping.org>2017-02-18 01:41:43 +0100
commit31ebd5274eb93ff96407395836d146179c119145 (patch)
treebdaaf120694b6fe3e05a0f25a5e063a6f3bcc56e
parentUpdate README.rst (diff)
downloadporticron-31ebd5274eb93ff96407395836d146179c119145.tar.gz
porticron-31ebd5274eb93ff96407395836d146179c119145.tar.bz2
porticron-31ebd5274eb93ff96407395836d146179c119145.zip
Resolve default duplication
-rwxr-xr-xbin/porticron19
1 files changed, 12 insertions, 7 deletions
diff --git a/bin/porticron b/bin/porticron
index 70600da..6153507 100755
--- a/bin/porticron
+++ b/bin/porticron
@@ -91,7 +91,7 @@ while getopts "hvVnc:" opt; do
done
-# defaults
+# defaults, more below
: ${VERBOSE:=0}
: ${NOMAIL:=0}
: ${PORTICRON_CONF:=/etc/porticron.conf}
@@ -119,6 +119,11 @@ IP=$(dig +short ${FQDN} | tr '\n' ' ')
DATE=$(date -R)
PORTDIR=$(portageq get_repo_path $(portageq envvar EROOT) gentoo)
+# defaults, second half
+: ${RCPT:=root@${FQDN}}
+: ${SYNC_CMD:=/usr/bin/emerge --sync}
+: ${SYNC_OVERLAYS_CMD:=/bin/true}
+
# replace variables
for var in FQDN HOST IP DATE; do
SUBJECT=${SUBJECT/\{$var\}/${!var}}
@@ -126,10 +131,10 @@ for var in FQDN HOST IP DATE; do
done
# sync if desired
-log "running SYNC_CMD: ${SYNC_CMD:-/usr/bin/emerge --sync}"
-${SYNC_CMD:-/usr/bin/emerge --sync} &>/dev/null
-log "running SYNC_OVERLAY_CMD: ${SYNC_OVERLAYS_CMD:-/bin/true}"
-${SYNC_OVERLAYS_CMD:-/bin/true} &>/dev/null
+log "running SYNC_CMD: ${SYNC_CMD}"
+${SYNC_CMD} &>/dev/null
+log "running SYNC_OVERLAY_CMD: ${SYNC_OVERLAYS_CMD}"
+${SYNC_OVERLAYS_CMD} &>/dev/null
# run emerge once to perform global updates while not cluttering mail output
@@ -156,7 +161,7 @@ The following updates should be performed for these GLSAs:
${GLSA_UPGRADES}
"
cat <<EOF | send_mail
-To: ${RCPT:-root@${FQDN}}
+To: ${RCPT}
From: root@${FQDN}
Subject: ${SUBJECT_WARN}
Date: ${DATE}
@@ -235,7 +240,7 @@ if [[ ${UPGRADE_MSG_CODE} -eq 1 && ${DIFF_MSG_CODE} -eq 1 ]]; then
fi
cat <<EOF | send_mail
-To: ${RCPT:-root@${FQDN}}
+To: ${RCPT}
From: root@${FQDN}
Subject: ${SUBJECT}
Date: ${DATE}