aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/porticron12
-rw-r--r--etc/porticron.conf8
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 <<EOF | send_mail
To: ${RCPT:-root@${FQDN}}
From: root@${FQDN}
-Subject: WARNING: Gentoo security updates on ${FQDN} [ ${IP} ]
+Subject: ${SUBJECT_WARN}
Date: ${DATE}
porticron report [${DATE}]
@@ -229,7 +237,7 @@ fi
cat <<EOF | send_mail
To: ${RCPT:-root@${FQDN}}
From: root@${FQDN}
-Subject: Gentoo package updates on ${FQDN} [ ${IP} ]
+Subject: ${SUBJECT}
Date: ${DATE}
porticron report [${DATE}]
diff --git a/etc/porticron.conf b/etc/porticron.conf
index a937e29..3869b65 100644
--- a/etc/porticron.conf
+++ b/etc/porticron.conf
@@ -22,6 +22,14 @@ UPGRADE_OPTS="--deep --update"
# recipient for reports
RCPT=root@$(hostname -f)
+# format of the e-mail subject
+# use {FQDN}, {HOST}, {IP}, and {DATE} as variables
+#SUBJECT="Gentoo package updates on {FQDN} [ {IP} ]"
+
+# format of the e-mail subject in case of warnings
+# use {FQDN}, {HOST}, {IP}, and {DATE} as variables
+#SUBJECT_WARN="WARNING: Gentoo security updates on {FQDN} [ {IP} ]"
+
# path to sendmail binary
SENDMAIL=/usr/sbin/sendmail