Fix musl condition for chroot case (#1369)
authorAdeel Mujahid <adeelbm@outlook.com>
Tue, 7 Jan 2020 22:12:46 +0000 (00:12 +0200)
committerDavis Goodin <dagood@users.noreply.github.com>
Tue, 7 Jan 2020 22:12:46 +0000 (16:12 -0600)
src/coreclr/init-distro-rid.sh

index 4e9100b..beb7451 100755 (executable)
@@ -30,7 +30,7 @@
 #   |  alpine*  |        linux-musl-(arch)          |
 #   |  freeBSD  |        freebsd.(version)-x64      |
 #
-# It is important to note that the function does not return anything, but it 
+# It is important to note that the function does not return anything, but it
 # will set __DistroRid if there is a non-portable distro rid to be used.
 #
 initNonPortableDistroRid()
@@ -52,7 +52,7 @@ initNonPortableDistroRid()
             # has been passed as false.
             if (( ${isPortable} == 0 )); then
                 if [ "${ID}" == "rhel" ]; then
-                    # remove the last version digit    
+                    # remove the last version digit
                     VERSION_ID=${VERSION_ID%.*}
                 fi
 
@@ -64,7 +64,7 @@ initNonPortableDistroRid()
                         nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
                 fi
             fi
-            
+
         elif [ -e "${rootfsDir}/etc/redhat-release" ]; then
             local redhatRelease=$(<${rootfsDir}/etc/redhat-release)
 
@@ -124,7 +124,7 @@ initDistroRidGlobal()
     local rootfsDir=$4
 
     # Setup whether this is a crossbuild. We can find this out if rootfsDir
-    # is set. 
+    # is set.
     local isCrossBuild=0
 
     if [ -z "${rootfsDir}" ]; then
@@ -154,7 +154,7 @@ initDistroRidGlobal()
         local distroRid=""
 
         # Check for musl-based distros (e.g Alpine Linux, Void Linux).
-        if (ldd --version 2>&1 || true) | grep -q musl; then
+        if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl; then
             distroRid="linux-musl-${buildArch}"
         fi
 
@@ -178,7 +178,7 @@ initDistroRidGlobal()
     else
         echo "__DistroRid: ${__DistroRid}"
         echo "__RuntimeId: ${__DistroRid}"
-        
+
         export __RuntimeId=${__DistroRid}
     fi
 }