Wrapper package for MailScanner

Scott Silva ssilva at sgvwater.com
Mon Jul 28 16:35:30 IST 2008

on 7-26-2008 11:53 AM Julian Field spake the following:
> My only comment on this would be this: just because 
> MailScanner.conf.rpmnew exists, how can you guarantee it was created by 
> *this* upgrade? I would check the version number inside it as well, or 
> you could rip out some of the user's configuration settings if the 
> *.rpmnew files exist from previous upgrades. I agree it's unlikely, but 
> it is possible.
> Steve Freegard wrote:
>> Hi Hugo,
>> Hugo van der Kooij wrote:
>>> At present the best I can think of is playing copycat with the
>>> instructions Jules provided and send it of in a message to the local 
>>> admin.
>>> The rpm packaging guidelines are quite explicit where it comes to
>>> interactive scripts (DON'T!) and Jules did the right thing in not
>>> executing the upgrade script in the mailscanner package as part of the
>>> post install scripts.
>> Interactive != automated.
>> Anything that requires input from the user is not allowed as 
>> rpm/yum/anaconda does not make provision for this.
>> Output from scriptlets is fine - providing you don't presume the 
>> output will be read and understood by a human.
>> Enabling and starting services is also a no-no.  Conditional restarts 
>> are acceptable on upgrades.
>>> Technically the user should see them if the "yum upgrade" command is
>>> executed but there is quite a bit of information and the user may not
>>> remember all steps that well.
>>> There might even be users that might run yum unattended and those would
>>> never see the instructions. I strongly believe that one should never run
>>> yum unattended but some people insist on doing the wrong thing.
>>> Any alternative suggestions?
>> Why bother telling the user to run a load of commands that they might 
>> forget or never see when it's fairly straightforward to do all of it 
>> for them using a %postun scriptlet that runs for upgrades only; check 
>> for the existance on MailScanner.conf.rpmnew and languages.conf.rpmnew 
>> and run upgrade_MailScanner_conf and upgrade_languages_conf accordingly.
>> If yum is run unattended (bad idea as you note) - root get's an email 
>> with the yum output anyway which will contain a log of the output 
>> otherwise they'll see output from the scriptlet to the screen when yum 
>> runs the update.
>> Here's the relevant scriptlet - it will probably need some tweaking as 
>> I haven't tested upgrades yet.
>> %postun
>> if [ "$1" -ge "1" ]; then
>>  # We are being upgraded or replaced, not deleted
>>  # Check for a new MailScanner.conf file
>>  if [ -f "/etc/MailScanner/MailScanner.conf.rpmnew" ]; then
>>   echo "Upgrading MailScanner.conf..."
>>   /usr/sbin/upgrade_MailScanner_conf /etc/MailScanner/MailScanner.conf 
>> /etc/MailScanner/MailScanner.conf.rpmnew > 
>> /etc/MailScanner/MailScanner.conf.new
>>   # TODO: make sure MailScanner.conf.new is not empty
>>   mv /etc/MailScanner/MailScanner.conf 
>> /etc/MailScanner/MailScanner.conf.old
>>   mv /etc/Mailscanner/MailScanner.conf.new 
>> /etc/MailScanner/MailScanner.conf
>>   rm -f /etc/MailScanner/MailScanner.conf.rpmnew
>>  fi
>>  # Check for a new languages.conf file
>>  # TODO:  Check all of the reports sub-directories for .rpmnew
>>  if [ -f "/etc/MailScanner/reports/en/languages.conf.rpmnew" ]; then
>>   echo "Upgrading languages.conf..."
>>   /usr/sbin/upgrade_langages_conf 
>> /etc/MailScanner/reports/en/languages.conf 
>> /etc/MailScanner/reports/en/languages.conf.rpmnew > 
>> /etc/MailScanner/reports/en/languages.conf.new
>>   # TODO:  make sure languages.conf.new is not empty
>>   mv /etc/MailScanner/reports/en/languages.conf 
>> /etc/MailScanner/reports/en/languages.conf.old
>>   mv /etc/MailScanner/reports/en/languages.conf.new 
>> /etc/MailScanner/reports/en/languages.conf
>>   rm -f /etc/MailScanner/reports/en/languages.conf.rpmnew
>>  fi
>>  # Done - restart MailScanner
>>  # TODO:  this should be a condrestart as per RPM package guidelines.
>>  service MailScanner restart
>> fi
>> exit 0
>> As you can probably guess from this - we're doing similar things; just 
>> in different ways.  They'll be an announcement from FSL about this 
>> once everything is ready and tested.
>> Cheers,
>> Steve.
> Jules
You would probably want some sort of flag file that a user could touch to stop 
the automatic upgrade of those files. It doesn't bother me, but I remember 
from list traffic that there are many people that have custom comments or 
other content that they wish to preserve.

Maybe a check like;

if [ -f "/etc/MailScanner/no-upgrade" ]; then
   skip upgrade

MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.mailscanner.info/pipermail/mailscanner/attachments/20080728/c476fa98/signature.bin

More information about the MailScanner mailing list