Scilab launch script: support i386 chroot on a x86_64 host 34/14234/3
Clément DAVID [Mon, 31 Mar 2014 06:40:24 +0000 (08:40 +0200)]
In such a config, uname returns host values. The right thing to do is to
check long size using getconf.

Change-Id: If747cc628030e8dc8adb6c131281cb2828169355

scilab/bin/scilab

index 277d45e..4446178 100755 (executable)
@@ -160,7 +160,15 @@ detect_os() {
         OS=$(uname -s) # Retrieve the Operating System
     fi
     if test "${MODEL}" = ""; then
-        MODEL=$(uname -m) # Retrieve the model
+        if ! long_size=$(getconf LONG_BIT); then
+            if test $long_size = "32"; then
+                MODEL=i386
+            else
+                MODEL=x86_64
+            fi
+        else
+            MODEL=$(uname -m) # Retrieve the model
+        fi
     fi
 
     if test $SCIVERBOSE -ne 0; then