]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ubuntu: Base arch detection code on debootstrap's with some additions when we...
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)
Changelog: [seh] Don't take arch from environment

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>
templates/lxc-ubuntu.in

index e73baa893a4bc804a47f631d21bb2d1043c8ab67..0a55f4cd507b51347d7a0d4091a5ec2e03ff4fee 100644 (file)
@@ -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