Hi,

On 13/09/16 18:37, Herbert Fortes wrote:
> I have to update 4 debian/*.preinst files.
> 
> Right now the files are like here[0]:
> 
> 
> if dpkg --compare-versions "$2" lt "1.2.4+dfsg1-7" ; then
>    rm -rf /usr/share/doc/bogofilter || true
> fi
> 
> 
> [0] -  
> https://anonscm.debian.org/git/collab-maint/bogofilter.git/tree/debian/bogofilter.preinst
> 
> 
> This approach has problems on an upgrade from Jessie to 
> Stretch[1].The recommendation today is to use 'dpkg-maintscript-helper', so
> I should change to ("a  real directory  is switched to a symlink"):
> 
> [1] - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832291
> 
> if dpkg-maintscript-helper supports dir_to_symlink 2>/dev/null; then
>                 dpkg-maintscript-helper dir_to_symlink \
>                /usr/share/doc/bogofilter bogofilter 1.2.4+dfsg1-8 bogofilter 
> -- "$@"          
> fi

Don't bother doing this. Use dh_installdeb and 'package.maintscript'
files instead. You can then drop all the preinst files.

>>From the manpage:
> 
> "pathname(/usr/share/doc/bogofilter here)  is the absolute name of the old 
> directory (the path will be a symlink at the end of the installation) and 
> new-target (bogofilter here) is the target of the  new  symlink at pathname. 
> It can either be absolute or relative to the directory containing pathname."
> 
> But the symlink is created by dh_installdocs[1] already. I just want to 
> remove 
> the directory.

Due to the way dpkg-maintscript-helper is implemented, the symlink
created with dh_installdocs is ignored, so dpkg-maintscript-helper will
create it for you. The manpage for dpkg-maintscript-helper also contains
an explanation of why 'just removing the directory in preinst' can cause
problems.

I think putting this into 'bogofilter-bdb.maintscript' and something
similar in other maintscript files should work:

dir_to_symlink /usr/share/doc/bogofilter-bdb
/usr/share/doc/bogofilter-common 1.2.4+dfsg1-8~

James

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to