On Thu, Sep 21, 2017 at 09:41:12PM +0200, Ola Lundqvist wrote:
> First, why do you change the meaning of the empty hostname. Do you
> want to be able to actually have an empty hostname or what was the
> intention of that slightly backwards incompatible change?

I do not remember any more. My new patch doesn't have this any more (but
is not yet sufficiently tested):
diff -urN cron-apt-0.10.0.orig/src/cron-apt cron-apt-0.10.0/src/cron-apt
--- cron-apt-0.10.0.orig/src/cron-apt   2016-11-28 22:36:45.000000000 +0100
+++ cron-apt-0.10.0/src/cron-apt        2017-09-21 16:22:43.298993411 +0200
@@ -258,6 +258,10 @@
 #        only    (only show the diff, not the output itself)
 #                (else do nothing)
 DIFFONCHANGES=prepend
+# Subject Supplement. This will be inserted into the subject of e-mails
+# sent out from CRON-APT and can for example be used to distinguish mails
+# sent from a certain group of systems.
+SUBJSUPPL=""

 export DEBIAN_FRONTEND="noninteractive"
 export LANG="C"
diff -urN cron-apt-0.10.0.orig/src/functions cron-apt-0.10.0/src/functions
--- cron-apt-0.10.0.orig/src/functions  2016-11-28 22:36:19.000000000 +0100
+++ cron-apt-0.10.0/src/functions       2017-09-21 16:23:21.454997710 +0200
@@ -99,10 +99,11 @@
            if [ -z "$HOSTNAME" ]; then
                HOSTNAME="$(uname -n)"
            fi
+           SUBJ="CRON-APT${SUBJSUPPL:+ $SUBJSUPPL}"
            if [ -f "$ERROR" ] ; then
-               HDR=$(printf "$HDR\nSubject: CRON-APT error on $HOSTNAME 
[$CONFIG]")
+               HDR=$(printf "$HDR\nSubject: $SUBJ error on $HOSTNAME 
[$CONFIG]")
            else
-               HDR=$(printf "$HDR\nSubject: CRON-APT completed on $HOSTNAME 
[$CONFIG]")
+               HDR=$(printf "$HDR\nSubject: $SUBJ completed on $HOSTNAME 
[$CONFIG]")
            fi
            # Support for XHEADERS
             i=1

> I do not see any documentation regarding how the new OKSUBJECT,
> ERRSUBJECT and SUBJECTSUPPL should be used.
> I guess that should be in the config file as well, right?

The new patch doesn't have this any more, since you changed that kind of logic
as well, making my addition even easier.

> What is the purpose of this?
> ${SUBJECTSUPPL:+$SUBJECTSUPPL }
> 
> Is that just to add a space after the variable if that one happen to
> be empty or?

This expands to either the empty string or the contents of the variable follwed
by a string. The new code, SUBJ="CRON-APT${SUBJSUPPL:+ $SUBJSUPPL}", expands
either to "CRON-APT" if SUBJSSUPPLY is empty, or for example to "CRON-APT
[unstable]" if SUBJSUPPL happens to be set to [unstable]. I use this so that I
can see immediately that this CRON-APT message was sent from a system running
unstable (which sends out a lot more of CRON-APT mails than a stable system).

Greetings
Marc
-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

Reply via email to