lxc-ubuntu: Use dpkg --add-architecture

When a container has dpkg >= 1.16.2, use dpkg --add-architecture
for multi-arch configuration on foreign architecture containers.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Serge Hallyn 2012-07-31 16:07:18 +02:00 committed by Daniel Lezcano
parent add1d11833
commit 40f6ee0088

View File

@ -469,8 +469,13 @@ post_process()
# If the container isn't running a native architecture, setup multiarch # If the container isn't running a native architecture, setup multiarch
if [ -x "$(ls -1 ${rootfs}/usr/bin/qemu-*-static 2>/dev/null)" ]; then if [ -x "$(ls -1 ${rootfs}/usr/bin/qemu-*-static 2>/dev/null)" ]; then
mkdir -p ${rootfs}/etc/dpkg/dpkg.cfg.d dpkg_version=$(chroot $rootfs dpkg-query -W -f='${Version}' dpkg)
echo "foreign-architecture ${hostarch}" > ${rootfs}/etc/dpkg/dpkg.cfg.d/lxc-multiarch if chroot $rootfs dpkg --compare-versions $dpkg_version ge "1.16.2"; then
chroot $rootfs dpkg --add-architecture ${hostarch}
else
mkdir -p ${rootfs}/etc/dpkg/dpkg.cfg.d
echo "foreign-architecture ${hostarch}" > ${rootfs}/etc/dpkg/dpkg.cfg.d/lxc-multiarch
fi
# Save existing value of MIRROR and SECURITY_MIRROR # Save existing value of MIRROR and SECURITY_MIRROR
DEFAULT_MIRROR=$MIRROR DEFAULT_MIRROR=$MIRROR