Hi Bob

You are perfectly correct. However I think maybe it is better
to change the variable name in the configuration file instead of the
code. That would make it backwards compatible.

Or what do you think?

Regards,

// Ola

On Fri, Jul 20, 2007 at 03:32:47PM -0600, Bob Proulx wrote:
> Package: cron-apt
> Version: 0.4.14
> Severity: normal
> Tags: patch
> 
> I have several chroot systems on the same machine.  When mail is sent
> from the machine from several of the chroots plus the supervisor
> system itself I could not tell which chroot the messages were coming
> from.  I browsed the cron-apt script and I see that there appears to
> be provision to add a header message to mail and syslog if it is
> available.  Placing a file /etc/cron-apt/mailonmsgs/upgrade with
> appropriate contents seems to be the intention.
> 
> But the current set of variables names do not match.  The variables
> are "MAILONMSGSDIR" ("MAIL <<ON>> MSGSDIR") and SYSLOGONMSGSDIR versus
> versions without the ON in the middle.
> 
>   MAILONMSGSDIR="/etc/cron-apt/mailonmsgs"
>   SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs"
>   ...
>   createmailinfo() {
>       touch "$MAIL"
>       if [ -n "$MAILON" ] && [ -f "$MAILMSGSDIR/$MAILON" ] ; then
>         cat "$MAILMSGSDIR/$MAILON" >> "$MAIL"
>       fi
>       createdivinfo "$MAIL" "$TEMP" "$MAILMSGDIR/$1" "$RUNMAIL" "$ACTIONMAIL"
>   }
> 
>   # ACTIONF as first argument
>   createsysloginfo() {
>       if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGMSGSDIR/$SYSLOGON" ] ; then
>         logger -p user.notice -t cron-apt -f "$SYSLOGMSGSDIR/$SYSLOGON"
>       fi
>       createdivinfo "syslog" "$TEMP" "$SYSLOGMSGDIR/$1" "$RUNSYSLOG" 
> "$ACTIONSYSLOG"
>   }
> 
> Here is the obvious patch to resolve this problem.  With this change a
> file /etc/cron-apt/mailonmsgs/upgrade will be prepended to the mail.
> 
> A workaround is for a local admin to put
> 
>   MAILMSGSDIR=/etc/cron-apt/mailonmsgs
> 
> in the /etc/cron-apt/config.d/0-update file.  This duplicates that
> variable with the current spelling and it then works with the Etch
> released version of the code.
> 
> Thanks
> Bob
> 
> Index: cron-apt
> ===================================================================
> --- cron-apt    (revision 2429)
> +++ cron-apt    (working copy)
> @@ -349,16 +349,16 @@
>  # ACTIONF as first argument
>  createmailinfo() {
>      touch "$MAIL"
> -    if [ -n "$MAILON" ] && [ -f "$MAILMSGSDIR/$MAILON" ] ; then
> -       cat "$MAILMSGSDIR/$MAILON" >> "$MAIL"
> +    if [ -n "$MAILON" ] && [ -f "$MAILONMSGSDIR/$MAILON" ] ; then
> +       cat "$MAILONMSGSDIR/$MAILON" >> "$MAIL"
>      fi
>      createdivinfo "$MAIL" "$TEMP" "$MAILMSGDIR/$1" "$RUNMAIL" "$ACTIONMAIL"
>  }
> 
>  # ACTIONF as first argument
>  createsysloginfo() {
> -    if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGMSGSDIR/$SYSLOGON" ] ; then
> -       logger -p user.notice -t cron-apt -f "$SYSLOGMSGSDIR/$SYSLOGON"
> +    if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGONMSGSDIR/$SYSLOGON" ] ; then
> +       logger -p user.notice -t cron-apt -f "$SYSLOGONMSGSDIR/$SYSLOGON"
>      fi
>      createdivinfo "syslog" "$TEMP" "$SYSLOGMSGDIR/$1" "$RUNSYSLOG" 
> "$ACTIONSYSLOG"
>  }
> 
> 

-- 
 --------------------- Ola Lundqvist ---------------------------
/  [EMAIL PROTECTED]                     Annebergsslingan 37      \
|  [EMAIL PROTECTED]                     654 65 KARLSTAD          |
|  http://opalsys.net/                 +46 (0)70-332 1551       |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36  4FE4 18A1 B1CF 0FE5 3DD9 /
 ---------------------------------------------------------------


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to