Skip to content

Use of --runtime-id generates incorrect primary URL #13

@wli3

Description

@wli3

From @sdmaclea

./dotnet-install.sh --runtime dotnet --dry-run --version 3.0.2 --runtime-id linux-musl-x64
dotnet-install: Payload URLs:
dotnet-install: Primary named payload URL: https://dotnetcli.azureedge.net/dotnet/Runtime/3.0.2/dotnet-runtime-3.0.2-linux-x64.tar.gz
dotnet-install: Legacy named payload URL: https://dotnetcli.azureedge.net/dotnet/Runtime/3.0.2/dotnet-linux-musl-x64.3.0.2.tar.gz
dotnet-install: Repeatable invocation: ./dotnet-install.sh --version "3.0.2" --install-dir "/home/stmaclea/.dotnet" --architecture "x64" --runtime "dotnet" --runtime-id "linux-musl-x64"

I believe it should be:

./dotnet-install.sh --runtime dotnet --dry-run --version 3.0.2 --runtime-id linux-musl-x64
dotnet-install: Payload URLs:
dotnet-install: Primary named payload URL: https://dotnetcli.azureedge.net/dotnet/Runtime/3.0.2/dotnet-runtime-3.0.2-linux-musl-x64.tar.gz
dotnet-install: Legacy named payload URL: https://dotnetcli.azureedge.net/dotnet/Runtime/3.0.2/dotnet-linux-musl-x64.3.0.2.tar.gz
dotnet-install: Repeatable invocation: ./dotnet-install.sh --version "3.0.2" --install-dir "/home/stmaclea/.dotnet" --architecture "x64" --runtime "dotnet" --runtime-id "linux-musl-x64"

I was able to get the correct behavior by revising get_current_os_name() to add the highlighted section.

get_current_os_name() {
   eval $invocation

   local uname=$(uname)
   if [ "$uname" = "Darwin" ]; then
       echo "osx"
       return 0
   elif [ "$uname" = "FreeBSD" ]; then
       echo "freebsd"
       return 0        
   elif [ -n "$runtime_id" ]; then
       echo $(get_legacy_os_name_from_platform "${runtime_id%-*}" || echo "${runtime_id%-*}")
       return 0
   elif [ "$uname" = "Linux" ]; then
       local linux_platform_name
       linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }

       if [ "$linux_platform_name" = "rhel.6" ]; then
           echo $linux_platform_name
           return 0
       elif is_musl_based_distro; then
           echo "linux-musl"
           return 0
       else
           echo "linux"
           return 0
       fi
   fi

   say_err "OS name could not be detected: UName = $uname"
   return 1
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions