Skip to content

Commit 702f623

Browse files
StanleyGoldmanZachary Eisinger
authored andcommitted
Updating package.json
1 parent c4b619a commit 702f623

File tree

4 files changed

+228
-31
lines changed

4 files changed

+228
-31
lines changed

externals/install-dotnet.ps1

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function Get-CLIArchitecture-From-Architecture([string]$Architecture) {
167167
{ $_ -eq "x86" } { return "x86" }
168168
{ $_ -eq "arm" } { return "arm" }
169169
{ $_ -eq "arm64" } { return "arm64" }
170-
default { throw "Architecture not supported. If you think this is a bug, report it at https://github.com/dotnet/cli/issues" }
170+
default { throw "Architecture not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues" }
171171
}
172172
}
173173

@@ -309,14 +309,12 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
309309

310310
If (-Not (Test-Path $JSonFile)) {
311311
throw "Unable to find '$JSonFile'"
312-
exit 0
313312
}
314313
try {
315314
$JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue
316315
}
317316
catch {
318317
throw "Json file unreadable: '$JSonFile'"
319-
exit 0
320318
}
321319
if ($JSonContent) {
322320
try {
@@ -330,16 +328,13 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
330328
}
331329
catch {
332330
throw "Unable to parse the SDK node in '$JSonFile'"
333-
exit 0
334331
}
335332
}
336333
else {
337334
throw "Unable to find the SDK node in '$JSonFile'"
338-
exit 0
339335
}
340336
If ($Version -eq $null) {
341337
throw "Unable to find the SDK:version node in '$JSonFile'"
342-
exit 0
343338
}
344339
return $Version
345340
}
@@ -430,7 +425,7 @@ function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePath
430425
Say-Invocation $MyInvocation
431426

432427
$DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion
433-
Say-Verbose "Is-Dotnet-Package-Installed: Path to a package: $DotnetPackagePath"
428+
Say-Verbose "Is-Dotnet-Package-Installed: DotnetPackagePath=$DotnetPackagePath"
434429
return Test-Path $DotnetPackagePath -PathType Container
435430
}
436431

@@ -663,8 +658,22 @@ if ($DownloadFailed) {
663658
Say "Extracting zip from $DownloadLink"
664659
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
665660

666-
# Check if the SDK version is now installed; if not, fail the installation.
667-
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
661+
# Check if the SDK version is installed; if not, fail the installation.
662+
$isAssetInstalled = $false
663+
664+
# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
665+
if ($SpecificVersion -Match "rtm" -or $SpecificVersion -Match "servicing") {
666+
$ReleaseVersion = $SpecificVersion.Split("-")[0]
667+
Say-Verbose "Checking installation: version = $ReleaseVersion"
668+
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $ReleaseVersion
669+
}
670+
671+
# Check if the SDK version is installed.
672+
if (!$isAssetInstalled) {
673+
Say-Verbose "Checking installation: version = $SpecificVersion"
674+
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
675+
}
676+
668677
if (!$isAssetInstalled) {
669678
throw "`"$assetName`" with version = $SpecificVersion failed to install with an unknown error."
670679
}

externals/install-dotnet.sh

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ get_linux_platform_name() {
144144
else
145145
if [ -e /etc/os-release ]; then
146146
. /etc/os-release
147-
echo "$ID.$VERSION_ID"
147+
echo "$ID${VERSION_ID:+.${VERSION_ID}}"
148148
return 0
149149
elif [ -e /etc/redhat-release ]; then
150150
local redhatRelease=$(</etc/redhat-release)
@@ -159,6 +159,10 @@ get_linux_platform_name() {
159159
return 1
160160
}
161161

162+
is_musl_based_distro() {
163+
(ldd --version 2>&1 || true) | grep -q musl
164+
}
165+
162166
get_current_os_name() {
163167
eval $invocation
164168

@@ -173,10 +177,10 @@ get_current_os_name() {
173177
local linux_platform_name
174178
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
175179

176-
if [[ $linux_platform_name == "rhel.6" ]]; then
180+
if [ "$linux_platform_name" = "rhel.6" ]; then
177181
echo $linux_platform_name
178182
return 0
179-
elif [[ $linux_platform_name == alpine* ]]; then
183+
elif is_musl_based_distro; then
180184
echo "linux-musl"
181185
return 0
182186
else
@@ -202,7 +206,7 @@ get_legacy_os_name() {
202206
else
203207
if [ -e /etc/os-release ]; then
204208
. /etc/os-release
205-
os=$(get_legacy_os_name_from_platform "$ID.$VERSION_ID" || echo "")
209+
os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "")
206210
if [ -n "$os" ]; then
207211
echo "$os"
208212
return 0
@@ -245,20 +249,29 @@ check_pre_reqs() {
245249
fi
246250

247251
if [ "$(uname)" = "Linux" ]; then
248-
if [ ! -x "$(command -v ldconfig)" ]; then
249-
echo "ldconfig is not in PATH, trying /sbin/ldconfig."
250-
LDCONFIG_COMMAND="/sbin/ldconfig"
252+
if is_musl_based_distro; then
253+
if ! command -v scanelf > /dev/null; then
254+
say_warning "scanelf not found, please install pax-utils package."
255+
return 0
256+
fi
257+
LDCONFIG_COMMAND="scanelf --ldpath -BF '%f'"
258+
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libintl)" ] && say_warning "Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)."
251259
else
252-
LDCONFIG_COMMAND="ldconfig"
260+
if [ ! -x "$(command -v ldconfig)" ]; then
261+
say_verbose "ldconfig is not in PATH, trying /sbin/ldconfig."
262+
LDCONFIG_COMMAND="/sbin/ldconfig"
263+
else
264+
LDCONFIG_COMMAND="ldconfig"
265+
fi
266+
local librarypath=${LD_LIBRARY_PATH:-}
267+
LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
253268
fi
254269

255-
local librarypath=${LD_LIBRARY_PATH:-}
256-
LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
257-
258-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libunwind)" ] && say_warning "Unable to locate libunwind. Probable prerequisite missing; install libunwind."
259-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
270+
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep zlib)" ] && say_warning "Unable to locate zlib. Probable prerequisite missing; install zlib."
271+
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep ssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
260272
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu."
261-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep -F libcurl.so)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
273+
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep lttng)" ] && say_warning "Unable to locate liblttng. Probable prerequisite missing; install libcurl."
274+
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libcurl)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
262275
fi
263276

264277
return 0
@@ -360,7 +373,7 @@ get_normalized_architecture_from_architecture() {
360373
;;
361374
esac
362375

363-
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/cli/issues"
376+
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues"
364377
return 1
365378
}
366379

@@ -471,6 +484,7 @@ parse_jsonfile_for_version() {
471484
return 1
472485
fi
473486

487+
unset IFS;
474488
echo "$version_info"
475489
return 0
476490
}
@@ -631,7 +645,7 @@ copy_files_or_dirs_from_list() {
631645
local osname="$(get_current_os_name)"
632646
local override_switch=$(
633647
if [ "$override" = false ]; then
634-
if [[ "$osname" == "linux-musl" ]]; then
648+
if [ "$osname" = "linux-musl" ]; then
635649
printf -- "-u";
636650
else
637651
printf -- "-n";
@@ -840,13 +854,27 @@ install_dotnet() {
840854
say "Extracting zip from $download_link"
841855
extract_dotnet_package "$zip_path" "$install_root"
842856
843-
# Check if the SDK version is now installed; if not, fail the installation.
844-
if ! is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
845-
say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
846-
return 1
857+
# Check if the SDK version is installed; if not, fail the installation.
858+
# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
859+
if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then
860+
IFS='-'
861+
read -ra verArr <<< "$specific_version"
862+
release_version="${verArr[0]}"
863+
unset IFS;
864+
say_verbose "Checking installation: version = $release_version"
865+
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then
866+
return 0
867+
fi
847868
fi
848869
849-
return 0
870+
# Check if the standard SDK version is installed.
871+
say_verbose "Checking installation: version = $specific_version"
872+
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
873+
return 0
874+
fi
875+
876+
say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
877+
return 1
850878
}
851879
852880
args=("$@")

0 commit comments

Comments
 (0)