From 73262b725669d79d9707db0792f3d0808b288838 Mon Sep 17 00:00:00 2001 From: Rainer Müller Date: Tue, 8 Oct 2013 20:13:25 +0200 Subject: Make subject format a configuration option --- bin/porticron | 12 ++++++++++-- etc/porticron.conf | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/porticron b/bin/porticron index e2de161..763ddb4 100755 --- a/bin/porticron +++ b/bin/porticron @@ -97,6 +97,8 @@ done : ${PORTICRON_CONF:=/etc/porticron.conf} : ${TMP:="/var/tmp/porticron."} : ${CHECK_DUP_MSG:=1} +: ${SUBJECT:=Gentoo package updates on {FQDN\} [ {IP\} ]} +: ${SUBJECT_WARN:=WARNING: Gentoo security updates on {FQDN\} [ {IP\} ]} log "using PORTICRON_CONF=${PORTICRON_CONF}, NOMAIL=${NOMAIL}, VERBOSE=${VERBOSE}" @@ -112,10 +114,16 @@ fi # detect some common variables SCRIPT_NAME=$(basename $0) FQDN=$(hostname --fqdn) +HOST=$(hostname -s) IP=$(dig +short ${FQDN} | tr '\n' ' ') DATE=$(date -R) PORTDIR=$(portageq portdir) +# replace variables +for var in FQDN HOST IP DATE; do + SUBJECT=${SUBJECT/\{$var\}/${!var}} + SUBJECT_WARN=${SUBJECT_WARN/\{$var\}/${!var}} +done # sync if desired log "running SYNC_CMD: ${SYNC_CMD:-/usr/bin/emerge --sync}" @@ -150,7 +158,7 @@ ${GLSA_UPGRADES} cat <