Skip to content

Commit

Permalink
Fix RID extraction in packages and test build for Alpine (dotnet#14656)
Browse files Browse the repository at this point in the history
* Fix RID extraction in packages and test build for Alpine

The host RID extraction in build-packages.sh and build-test.sh
was not matching the one in build.sh

* Reflect feedback
  • Loading branch information
janvorli authored Oct 23, 2017
1 parent 458c90a commit 3315923
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
10 changes: 9 additions & 1 deletion build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ initHostDistroRid()
if [ "$__HostOS" == "Linux" ]; then
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
fi
__HostDistroRid="$ID.$VERSION_ID-$__Arch"
elif [ -e /etc/redhat-release ]; then
local redhatRelease=$(</etc/redhat-release)
Expand All @@ -24,9 +28,13 @@ initHostDistroRid()
fi
fi
fi
if [ "$__HostOS" == "FreeBSD" ]; then
__freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
__HostDistroRid="freebsd.$__freebsd_version-$__Arch"
fi

if [ "$__HostDistroRid" == "" ]; then
echo "WARNING: Can not determine runtime id for current distro."
echo "WARNING: Cannot determine runtime id for current distro."
fi
}

Expand Down
23 changes: 19 additions & 4 deletions build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

initHostDistroRid()
{
__HostDistroRid=""
if [ "$__HostOS" == "Linux" ]; then
if [ ! -e /etc/os-release ]; then
echo "WARNING: Can not determine runtime id for current distro."
__HostDistroRid=""
else
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
fi
__HostDistroRid="$ID.$VERSION_ID-$__HostArch"
elif [ -e /etc/redhat-release ]; then
local redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
__HostDistroRid="rhel.6-$__HostArch"
fi
fi
fi
if [ "$__HostOS" == "FreeBSD" ]; then
__freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
__HostDistroRid="freebsd.$__freebsd_version-$__HostArch"
fi

if [ "$__HostDistroRid" == "" ]; then
echo "WARNING: Cannot determine runtime id for current distro."
fi
}

initTargetDistroRid()
Expand Down

0 comments on commit 3315923

Please sign in to comment.