apache module postinst/prerm scripts
Hi
I'm returning on to the problem of properly dealing with postinst/prerm
scripts of an Apache module package.
I shaped the postinst/prerm for libapache2-mod-rivet following the template
shown on the wiki.
The postinst script work well if one installs the package, then purge it
and reinstalls it later on.
if [ "$1" = configure ] ; then
# only enable on new installs, not on upgrades
if [ -z "$2" ] ; then
a2enmod -q something
fi
# only restart if mod_something is enabled
if [ -e /etc/apache2/mods-enabled/something.load ] ; then
invoke-rc.d apache2 restart
fi
fi
when the $2 arguments is defined it is assumed the operation is an
upgrade and a2enmod is not called. The $2 arguments is not only set
during upgrades though, but also when reinstalling
the package after a 'dpkg --remove <package-name>'.
In fact the prerm on the wiki is
if [ "$1" = remove ] ; then
a2dismod -q -f something || true
invoke-rc.d apache2 restart
fi
So, after a remove and subsequent install the package is disabled because
the symlinks from mods-enabled to mods-available are missing. I'm not
sure I if I got it right, but it seems to me the checks on the arguments
have to be changed, perhaps reenabling the module anyway under
specific conditions (new-version == old-version ?). Any suggestion?
-- Massimo
Reply to: