Wrapper package for MailScanner
Steve Freegard
steve.freegard at fsl.com
Sat Jul 26 15:09:59 IST 2008
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.
More information about the MailScanner
mailing list