Preserve CURRENT_PLATFORM in dev.sh

This commit is contained in:
David Kale
2019-11-07 13:27:08 -05:00
parent 2f3f51b303
commit 39b4472a5f

View File

@@ -28,43 +28,40 @@ if [[ "$DEV_CONFIG" == "Release" ]]; then
BUILD_CONFIG="Release" BUILD_CONFIG="Release"
fi fi
if [[ -n "$DEV_TARGET_RUNTIME" ]]; then CURRENT_PLATFORM="windows"
RUNTIME_ID="$DEV_TARGET_RUNTIME" if [[ ($(uname) == "Linux") || ($(uname) == "Darwin") ]]; then
else
echo "Automatically determining target runtime"
CURRENT_PLATFORM="windows"
if [[ ($(uname) == "Linux") || ($(uname) == "Darwin") ]]; then
CURRENT_PLATFORM=$(uname | awk '{print tolower($0)}') CURRENT_PLATFORM=$(uname | awk '{print tolower($0)}')
fi fi
if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
RUNTIME_ID='win-x64' RUNTIME_ID='win-x64'
if [[ "$PROCESSOR_ARCHITECTURE" == 'x86' ]]; then if [[ "$PROCESSOR_ARCHITECTURE" == 'x86' ]]; then
RUNTIME_ID='win-x86' RUNTIME_ID='win-x86'
fi fi
elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
RUNTIME_ID="linux-x64" RUNTIME_ID="linux-x64"
if command -v uname > /dev/null; then if command -v uname > /dev/null; then
CPU_NAME=$(uname -m) CPU_NAME=$(uname -m)
case $CPU_NAME in case $CPU_NAME in
armv7l) RUNTIME_ID="linux-arm";; armv7l) RUNTIME_ID="linux-arm";;
aarch64) RUNTIME_ID="linux-arm64";; aarch64) RUNTIME_ID="linux-arm64";;
esac esac
fi fi
if [ -e /etc/redhat-release ]; then if [ -e /etc/redhat-release ]; then
redhatRelease=$(</etc/redhat-release) redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
RUNTIME_ID='rhel.6-x64' RUNTIME_ID='rhel.6-x64'
fi fi
fi
elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then
RUNTIME_ID='osx-x64'
fi
echo "$RUNTIME_ID"
fi fi
elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then
RUNTIME_ID='osx-x64'
fi
if [[ -n "$DEV_TARGET_RUNTIME" ]]; then
RUNTIME_ID="$DEV_TARGET_RUNTIME"
fi
# Make sure current platform support publish the dotnet runtime # Make sure current platform support publish the dotnet runtime
# Windows can publish win-x86/x64 # Windows can publish win-x86/x64