[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug #583585 dpkg-maintscript-helper



Hello,

On Tue, 06 Dec 2011, Gianluca Ciccarelli wrote:
> >1/ replacing a directory with a symlink
> >
> >   v1 has /foo/bar as directory
> >   v2 has /foo/bar as symlink
> >
> [...]
> 
> Now I have a problem :) I interpret your notation as: before, we have a
> directory /foo/bar; after, we have a symlink /foo/bar.
> 
> Where is the directory supposed to go after I run the script's option?

You should not have to care about this. The package installs the files in
a new place, your only task is to ensure that /foo/bar is moved away so
that dpkg can install the symlink in /foo/bar.

> >Have you read the parts of the debian policy that explain dpkg's behaviour
> >with symlinks and directories?
> 
> I've looked into the debian policy and the only specific thing I've
> found is about symlinks (in section 10.5. of
> /usr/share/doc/debian-policy/policy.txt.gz), that basically describes
> the cases when a link should be absolute and when relative. Did you
> refer to something else?

Yes,
http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-unpackphase
and in particular at end of point 4:

“A directory will never be replaced by a symbolic link to a directory or
vice versa; instead, the existing state (symlink or not) will be left
alone and dpkg will follow the symlink if there is one.”

It's important also to know what happens at each step so that you know
what you must do in each maintainer script.

Basically you must ensure that the directory is only owned by the current
package, then move it away in the "preinst upgrade". In the "postinst
configure" you can drop the directory that you moved away. In case of
error, you should reinstall the directory that you moved away in "postrm
abort-upgrade".

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/


Reply to: