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

Re: Bug #583585 dpkg-maintscript-helper

Hello dpkg-ers,

Thanks for the comments so far, they were really useful.

I start to see some light. I report on my ideas to let you know that I'm
working on it, and to get some feedback, if possible.

On 2011/12/07 08:05AM, Raphael Hertzog wrote:
>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

I've read dpkg-maintscript-helper's man page. We want some commands in
the script, invoked by the maintainer scripts always as:
dpkg-maintscript-helper <my_command_name> <options> \
  -- "$@"

that executes differently according to the value of the variable
DPKG_MAINTSCRIPT_NAME. Let's assume I want to address the first issue,
that is, move away a directory $dir and substitute it with a symlink
with the same name.

In the preinst script, "upgrade" command, I'd invoke the helper as
above, and it will result in something like (as per Raphael's
1) # Ensure ownership of $dir by the package
2) mv "$dir" "$dir".dpkg_bak

In postinst, command "configure", I'd have
1) rm -rf "$dir".dpkg_bak

and finally, in postrm upgrade I'd have:
1) mv "$dir".dpkg_bak "$dir"

Of course I've omitted the security/error checks and other code for now,
that might clutter my point.

Thanks for reading so far, more soon!

Gianluca Ciccarelli
GPG key ID: FDF429B0

Attachment: signature.asc
Description: Digital signature

Reply to: