[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]



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.

HTH,
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@debian.org |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature


Reply to: