]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
templates: Add mips hostarch detection to debian
authorJames Cowgill <james410@cowgill.org.uk>
Mon, 15 Aug 2016 16:10:00 +0000 (16:10 +0000)
committerJames Cowgill <james410@cowgill.org.uk>
Thu, 18 Aug 2016 15:49:15 +0000 (16:49 +0100)
Signed-off-by: James Cowgill <james410@cowgill.org.uk>
templates/lxc-debian.in

index 3ada90d340ce54282d425b80af4f2b3e941aaa59..18d8422beaa065b0f17b253de577ac6152bae6d2 100644 (file)
@@ -647,6 +647,8 @@ if [ $? -ne 0 ]; then
 fi
 eval set -- "$options"
 
+littleendian=$(lscpu | grep '^Byte Order' | grep -q Little && echo yes)
+
 arch=$(uname -m)
 if [ "$arch" = "i686" ]; then
     arch="i386"
@@ -654,6 +656,10 @@ elif [ "$arch" = "x86_64" ]; then
     arch="amd64"
 elif [ "$arch" = "armv7l" ]; then
     arch="armhf"
+elif [ "$arch" = "mips" -a "$littleendian" = "yes" ]; then
+    arch="mipsel"
+elif [ "$arch" = "mips64" -a "$littleendian" = "yes" ]; then
+    arch="mips64el"
 fi
 hostarch=$arch
 mainonly=1
@@ -711,6 +717,14 @@ if [ "$interpreter" = "" ] ; then
         echo "can't create $arch container on $hostarch"
         exit 1
     fi
+
+    if [ $hostarch = "mips" -a $arch != "mips" ] || \
+       [ $hostarch = "mipsel" -a $arch != "mipsel" ] || \
+       [ $hostarch = "mips64" -a $arch != "mips" -a $arch != "mips64" ] || \
+       [ $hostarch = "mips64el" -a $arch != "mipsel" -a $arch != "mips64el" ]; then
+        echo "can't create $arch container on $hostarch"
+        exit 1
+    fi
 else
     if ! file -b "${interpreter}" |grep -q "statically linked" ; then
         echo "'${interpreter}' must be statically linked" 1>&2