Re: fixing this
Hi Norbert,
[don't forget to Cc: the -submitter]
On Friday, 11. May 2012 01:21:10 Norbert Preining wrote:
> I have made the following additions to the preinst of ptex-bin:
preinst is probably too early to remove the diversions (the old package is
still installed so both orig_file (the version from ptex-bin) and
diverted_file (from whatever package) could exist in the file system.
But postinst should be fine to do the cleanup.
> if dpkg --compare-versions "$2" le "2011.20120509-1" ; then
use 'le-nl' unless you want to run this on initial install ($2=""), too
> # these will give a warning message for installations who
> # did install ptex-bin only from 2011 and not the old one
For noiseless removal of diversions you could use something like:
Pre-Depends: dpkg (>= 1.15)
(plain Depends: would be sufficient if this gets into postinst only)
undivert()
{
file_orig="$1"
diverter="$(dpkg-divert --listpackage "$file_orig")"
if [ -n "$diverter" ]; then
file_diverted="$(dpkg-divert --truename "$file_orig")"
dpkg-divert --remove --rename --package "$diverter" \
--divert "$file_diverted" "$file_orig"
fi
}
undivert /usr/bin/pltotf
undivert /usr/share/man/man1/pltotf.1.gz
undivert /usr/bin/tftopl
undivert /usr/share/man/man1/tftopl.1.gz
(untested, but in glx-diversions.postinst I used something much more complex
to cleanup+migrate some diversions)
> Please let me know if you think this appropriate or if we need anything
> more?
You only need to remove the old diversions, there are no new diversions to be
created?
Andreas
Reply to: