Since dpkg-divert takes a package name as an arg, you should not need
the other binary package. I don't know what policy/lintian say about
dpkg-divert invocations though.

First, remove this from the postinst:

# The target of the diversion somehow disappeared which will cause
# the divert removal to fail; we don't want that to happen
[ -e "/usr/bin/screen.real" ] && [ ! -e "/usr/bin/screen" ] && cp -a 
/usr/bin/screen.real /usr/bin/screen

I think the following script fragment (with an appropriate version test
maybe?) will clean this situation up:

if [ -f /usr/bin/screen ] && [ -f /usr/bin/screen.real ]; then
  divertpkg=$(dpkg-divert --listpackage /usr/bin/screen)
  if [ "$divertpkg" = "screen-profiles" ]; then
     rm /usr/bin/screen
     dpkg-divert --package screen-profiles --rename --remove /usr/bin/screen
  fi
fi

This is how I re-created the situation to test. I don't know if it
covers all the possible situations that machines can be in.

dpkg-divert --package screen-profiles --add --divert /usr/bin/screen.real 
--rename /usr/bin/screen
cp -a /usr/bin/screen.real  /usr/bin/screen

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/727738

Title:
  dpkg keeps diversions for removed packages

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to