Re: multiarch and maintainer scripts
On Thu, 2009-07-02 at 13:58:48 -0700, Russ Allbery wrote:
> Goswin von Brederlow <firstname.lastname@example.org> writes:
> > what can be done if the maintainer scripts of a package must behave
> > differently when unpacking the i386 deb on i386 or the i386 deb on
> > amd64?
We discussed this with Steve some days ago. My initial idea was to
make “dpkg --print-architecture” polymorphic, and change what it
prints depending on what architecture the package being installed is.
That would require less packaging changes, but it seems pretty
fragile and non-obvious behaviour, and we have several packages using
“uname -m”, they'd need to be changed due to this or just to
multiarchify them anyway, so we discarded it.
But yesterday I came up with a simpler and cleaner solution, just
export an env var matching the package arch being installed. Something
like DPKG_MAINTSCRIPT_ARCH or similar.
> > For example 32bit fglrx-glx needs to divert /usr/lib/libGL.so.1.2 on
> > i386 but /usr/lib32/libGL.so.1.2 on amd64.
I don't think this example is relevant. Once libgl has been
multiarchified, then everywhere the i386 file is going to be located
> Surely this is as simple as:
> case `dpkg --print-architecture` in
> # Do some stuff.
> # Do some other stuff.
> isn't it?
In this case it might have been enough, or not needed at all.
But that would print the arch dpkg was built for (i.e. the native
architecture), not the foreign arch of the package we are installing,
which is what we'd be interested in most cases like grub, eglibc,
module-init-tools or util-linux maint scripts.