Re: Bug #583585 dpkg-maintscript-helper
Hello,
On Thu, 15 Dec 2011, Gianluca Ciccarelli wrote:
> 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.
So $dir is part of the <options> above. We also need the first version
that contains the directory instead of the symlink so that we can do the
command only when required (and not on future upgrades).
> In the preinst script, "upgrade" command, I'd invoke the helper as
> above, and it will result in something like (as per Raphael's
> suggestions):
> 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
Yes.
> and finally, in postrm upgrade I'd have:
> 1) mv "$dir".dpkg_bak "$dir"
Here it should be "postrm failed-upgrade" I think. And it should not fail
if $dir.dpkg_bak does not exist (the failure to upgrade might be due to
something else and maybe that dir doesn't exist yet).
BTW for consistency please use ".dpkg-bak" and not ".dpkg_bak".
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: