From 81e922644387cd44ad7ba3a9656afaa9ffb8c152 Mon Sep 17 00:00:00 2001 From: jbeisner Date: Mon, 9 Apr 2018 23:01:09 +0000 Subject: [PATCH 1/2] Introduce support for arm & arm64 architectures; when detecting a missing 'library' prerequisite - do not fail the installation. --- scripts/obtain/dotnet-install.sh | 43 +++++++++++--------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index 55de51b91d..07d0c9557c 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -230,8 +230,6 @@ check_min_reqs() { check_pre_reqs() { eval $invocation - local failing=false; - if [ "${DOTNET_INSTALL_SKIP_PREREQS:-}" = "1" ]; then return 0 fi @@ -247,14 +245,10 @@ check_pre_reqs() { local librarypath=${LD_LIBRARY_PATH:-} LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }" - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libunwind)" ] && say_err "Unable to locate libunwind. Install libunwind to continue" && failing=true - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libssl)" ] && say_err "Unable to locate libssl. Install libssl to continue" && failing=true - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_err "Unable to locate libicu. Install libicu to continue" && failing=true - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep -F libcurl.so)" ] && say_err "Unable to locate libcurl. Install libcurl to continue" && failing=true - fi - - if [ "$failing" = true ]; then - return 1 + [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libunwind)" ] && say_warning "Unable to locate libunwind. Probable prerequisite missing; please install libunwind." + [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; please install libssl." + [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; please install libicu." + [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep -F libcurl.so)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; please install libcurl." fi return 0 @@ -309,14 +303,6 @@ combine_paths() { return 0 } -get_machine_architecture() { - eval $invocation - - # Currently the only one supported - echo "x64" - return 0 -} - # args: # architecture - $1 get_normalized_architecture_from_architecture() { @@ -324,17 +310,17 @@ get_normalized_architecture_from_architecture() { local architecture="$(to_lowercase "$1")" case "$architecture" in - \) - echo "$(get_normalized_architecture_from_architecture "$(get_machine_architecture)")" - return 0 - ;; amd64|x64) echo "x64" return 0 ;; - x86) - say_err "Architecture \`x86\` currently not supported" - return 1 + arm|arm32) + echo "arm" + return 0 + ;; + arm64) + echo "arm64" + return 0 ;; esac @@ -790,7 +776,7 @@ temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" channel="LTS" version="Latest" install_dir="" -architecture="" +architecture="x64" dry_run=false no_path=false azure_feed="https://dotnetcli.azureedge.net/dotnet" @@ -872,7 +858,7 @@ do echo "$script_name is a simple command line interface for obtaining dotnet cli." echo "" echo "Options:" - echo " -c,--channel Download from the CHANNEL specified, Defaults to \`$channel\`." + echo " -c,--channel Download from the channel specified, Defaults to \`$channel\`." echo " -Channel" echo " Possible values:" echo " - Current - most current release" @@ -891,8 +877,9 @@ do echo " examples: 2.0.0-preview2-006120; 1.1.0" echo " -i,--install-dir Install under specified location (see Install Location below)" echo " -InstallDir" - echo " --architecture Architecture of .NET Tools. Currently only x64 is supported." + echo " --architecture Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." echo " --arch,-Architecture,-Arch" + echo " Possible values: x64, arm, and arm64" echo " --runtime Installs a shared runtime only, without the SDK." echo " -Runtime" echo " Possible values:" From 35243a322f523510f67e58ced7b2699d3900bbc5 Mon Sep 17 00:00:00 2001 From: jbeisner Date: Tue, 10 Apr 2018 17:09:32 +0000 Subject: [PATCH 2/2] Auto-detect 'armv7l' and 'aarch64' --- scripts/obtain/dotnet-install.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index 07d0c9557c..80dde3a565 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -303,6 +303,28 @@ combine_paths() { return 0 } +get_machine_architecture() { + eval $invocation + + if command -v uname > /dev/null; then + CPUName=$(uname -m) + case $CPUName in + armv7l) + echo "arm" + return 0 + ;; + aarch64) + echo "arm64" + return 0 + ;; + esac + fi + + # Always default to 'x64' + echo "x64" + return 0 +} + # args: # architecture - $1 get_normalized_architecture_from_architecture() { @@ -310,15 +332,19 @@ get_normalized_architecture_from_architecture() { local architecture="$(to_lowercase "$1")" case "$architecture" in + \) + echo "$(get_normalized_architecture_from_architecture "$(get_machine_architecture)")" + return 0 + ;; amd64|x64) echo "x64" return 0 ;; - arm|arm32) + arm) echo "arm" return 0 ;; - arm64) + arm64) echo "arm64" return 0 ;; @@ -776,7 +802,7 @@ temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" channel="LTS" version="Latest" install_dir="" -architecture="x64" +architecture="" dry_run=false no_path=false azure_feed="https://dotnetcli.azureedge.net/dotnet"