From: Serge Hallyn Date: Sat, 25 Jun 2011 13:17:47 +0000 (+0200) Subject: lxc-ubuntu: Base arch detection code on debootstrap's with some additions when we... X-Git-Tag: lxc-0.7.5~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8339b4c86a111a38e398f576318632491facb7ad;p=thirdparty%2Flxc.git lxc-ubuntu: Base arch detection code on debootstrap's with some additions when we don't have dpkg or udpkg Changelog: [seh] Don't take arch from environment Signed-off-by: Stéphane Graber Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index e73baa893..0a55f4cd5 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -393,14 +393,24 @@ eval set -- "$options" release=lucid bindhome= arch=$(arch) -trim_container=0 -if [ "$arch" == "x86_64" ]; then arch=amd64 -fi -if [ "$arch" == "i686" ]; then - arch=i386 +# Code taken from debootstrap +if [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then + arch=`/usr/bin/dpkg --print-architecture` +elif type udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then + arch=`/usr/bin/udpkg --print-architecture` +else + arch=$(arch) + if [ "$arch" = "i686" ]; then + arch="i386" + elif [ "$arch" = "x86_64" ]; then + arch="amd64" + elif [ "$arch" = "armv7l" ]; then + arch="armel" + fi fi +trim_container=0 hostarch=$arch while true do