assistance with ubuntu-docs bug

Steve Langasek steve.langasek at ubuntu.com
Mon Mar 30 09:01:18 BST 2009


On Mon, Mar 30, 2009 at 10:32:54AM +0300, Lars Wirzenius wrote:
> ma, 2009-03-30 kello 08:10 +0100, Matthew East kirjoitti:
> > So we need something in the package maintainer scripts which will
> > remove the symlink and permit the package to install the relevant
> > files in its place. The relevant commands have been posted in comment
> > 15 on the bug, but I don't know how to include these in the package.
> > Is someone able to help?

> Let's see if I remember all this correctly, it's been a while since I
> did anything substantial with maintainer scripts.

> You need a preinst script to remove /usr/share/gnome/help/libs, if it is
> a symlink, and the package is being upgraded. Create
> debian/ubuntu-docs.preinst, with something like the following content:

The problem is the opposite in this case; it was a directory before, now
it's a symlink.  The principle is the same, but in that case you would
ideally do the removal in the postinst because it preserves certain unwind
scenarios (Debian policy 6.6).

postinst:

---- 8< ----
#!/bin/sh

set -e

link=/usr/share/gnome/help/libs
if [ -d "$link" ] && ! [ -L "$link" ] && [ "$1" = configure ] \
   && dpkg --compare-versions "$2" lt-nl <version-which-fixes-this>
then
	rmdir "$link"
	ln -s ../../ubuntu-docs/libs "$link"
fi

#DEBHELPER#

---- 8< ----

Another benefit of doing this in the postinst is that if something else has
added files under /usr/share/gnome/help/libs without talking to you, the
maintainer script will abort instead of silently rm -r'ing the files.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org



More information about the ubuntu-devel mailing list