[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "combined" prerm script problem [Bug#337223: fail2ban: leaves garbage around after purge]



On Thu, Nov 03, 2005 at 06:43:41PM +0000, Stephen Gran wrote:
> This one time, at band camp, Yaroslav Halchenko said:
> > Dear All,
> > 
> > I'm maintaining fail2ban package and got a bug report about garbage left
> > after purge on the package. The problem lies in prerm script which first
> > tries to stop fail2ban and then if stop was successfull removes .py[co]
> > files (added by dh_python) which were compiled/installed on first
> > start of fail2ban:
> > 
> > #!/bin/sh
> > set -e
> > # Automatically added by dh_installinit
> > if [ -x "/etc/init.d/fail2ban" ]; then
> >         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
> >                 invoke-rc.d fail2ban stop || exit 0
> >         else
> >                 /etc/init.d/fail2ban stop || exit 0
> >         fi
> > fi
> > # End automatically added section
> > # Automatically added by dh_python
> > dpkg -L fail2ban |
> >         awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
> >         xargs rm -f >&2
> > # End automatically added section
> > 
> > The simplest solution is to override error-handler for dh_installinit
> > but that will impact postinst script as well and I don't want to have
> > such side effect. What would be a proper solution or do I have to
> > contact debhelper team (or -dev list) to resolve this case.
> > I would like to avoid hacking my own prerm since it will not be a proper
> > solution
> 
> If you are generating the compiled python code in postinst, then remove
> the compiled code in prerm.  Put the second snippet in the prerm script
> before the debhelper token.
Nearly everything is done by debhelper, and the location of the
snippets doesn't seem to be customizable:

  dh_python

       If some modules need to be byte-compiled at install time,
       appropriate postinst and prerm scripts will be generated. If
       already byte-compiled modules are found, they are removed.

Only the postinst script is provided in the source package; the rest
is generated entirely by DH.  The postinst has: #DEBHELPER#, which
creates compiles the python modules and starts the daemon; postrm
removes the initscript on purge.

-- 
Clear skies,
Justin



Reply to: