mirror of
https://github.com/actions/runner.git
synced 2025-12-13 19:03:44 +00:00
Update dotnet-install scripts (#207)
This commit is contained in:
27
src/Misc/dotnet-install.ps1
vendored
27
src/Misc/dotnet-install.ps1
vendored
@@ -167,7 +167,7 @@ function Get-CLIArchitecture-From-Architecture([string]$Architecture) {
|
|||||||
{ $_ -eq "x86" } { return "x86" }
|
{ $_ -eq "x86" } { return "x86" }
|
||||||
{ $_ -eq "arm" } { return "arm" }
|
{ $_ -eq "arm" } { return "arm" }
|
||||||
{ $_ -eq "arm64" } { return "arm64" }
|
{ $_ -eq "arm64" } { return "arm64" }
|
||||||
default { throw "Architecture not supported. If you think this is a bug, report it at https://github.com/dotnet/cli/issues" }
|
default { throw "Architecture not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,14 +309,12 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
|
|||||||
|
|
||||||
If (-Not (Test-Path $JSonFile)) {
|
If (-Not (Test-Path $JSonFile)) {
|
||||||
throw "Unable to find '$JSonFile'"
|
throw "Unable to find '$JSonFile'"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue
|
$JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throw "Json file unreadable: '$JSonFile'"
|
throw "Json file unreadable: '$JSonFile'"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
if ($JSonContent) {
|
if ($JSonContent) {
|
||||||
try {
|
try {
|
||||||
@@ -330,16 +328,13 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
|
|||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throw "Unable to parse the SDK node in '$JSonFile'"
|
throw "Unable to parse the SDK node in '$JSonFile'"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw "Unable to find the SDK node in '$JSonFile'"
|
throw "Unable to find the SDK node in '$JSonFile'"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
If ($Version -eq $null) {
|
If ($Version -eq $null) {
|
||||||
throw "Unable to find the SDK:version node in '$JSonFile'"
|
throw "Unable to find the SDK:version node in '$JSonFile'"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
return $Version
|
return $Version
|
||||||
}
|
}
|
||||||
@@ -430,7 +425,7 @@ function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePath
|
|||||||
Say-Invocation $MyInvocation
|
Say-Invocation $MyInvocation
|
||||||
|
|
||||||
$DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion
|
$DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion
|
||||||
Say-Verbose "Is-Dotnet-Package-Installed: Path to a package: $DotnetPackagePath"
|
Say-Verbose "Is-Dotnet-Package-Installed: DotnetPackagePath=$DotnetPackagePath"
|
||||||
return Test-Path $DotnetPackagePath -PathType Container
|
return Test-Path $DotnetPackagePath -PathType Container
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,8 +658,22 @@ if ($DownloadFailed) {
|
|||||||
Say "Extracting zip from $DownloadLink"
|
Say "Extracting zip from $DownloadLink"
|
||||||
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
|
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
|
||||||
|
|
||||||
# Check if the SDK version is now installed; if not, fail the installation.
|
# Check if the SDK version is installed; if not, fail the installation.
|
||||||
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
|
$isAssetInstalled = $false
|
||||||
|
|
||||||
|
# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
|
||||||
|
if ($SpecificVersion -Match "rtm" -or $SpecificVersion -Match "servicing") {
|
||||||
|
$ReleaseVersion = $SpecificVersion.Split("-")[0]
|
||||||
|
Say-Verbose "Checking installation: version = $ReleaseVersion"
|
||||||
|
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $ReleaseVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the SDK version is installed.
|
||||||
|
if (!$isAssetInstalled) {
|
||||||
|
Say-Verbose "Checking installation: version = $SpecificVersion"
|
||||||
|
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
|
||||||
|
}
|
||||||
|
|
||||||
if (!$isAssetInstalled) {
|
if (!$isAssetInstalled) {
|
||||||
throw "`"$assetName`" with version = $SpecificVersion failed to install with an unknown error."
|
throw "`"$assetName`" with version = $SpecificVersion failed to install with an unknown error."
|
||||||
}
|
}
|
||||||
|
|||||||
58
src/Misc/dotnet-install.sh
vendored
58
src/Misc/dotnet-install.sh
vendored
@@ -144,7 +144,7 @@ get_linux_platform_name() {
|
|||||||
else
|
else
|
||||||
if [ -e /etc/os-release ]; then
|
if [ -e /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
echo "$ID.$VERSION_ID"
|
echo "$ID${VERSION_ID:+.${VERSION_ID}}"
|
||||||
return 0
|
return 0
|
||||||
elif [ -e /etc/redhat-release ]; then
|
elif [ -e /etc/redhat-release ]; then
|
||||||
local redhatRelease=$(</etc/redhat-release)
|
local redhatRelease=$(</etc/redhat-release)
|
||||||
@@ -159,6 +159,10 @@ get_linux_platform_name() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_musl_based_distro() {
|
||||||
|
(ldd --version 2>&1 || true) | grep -q musl
|
||||||
|
}
|
||||||
|
|
||||||
get_current_os_name() {
|
get_current_os_name() {
|
||||||
eval $invocation
|
eval $invocation
|
||||||
|
|
||||||
@@ -173,10 +177,10 @@ get_current_os_name() {
|
|||||||
local linux_platform_name
|
local linux_platform_name
|
||||||
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
|
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
|
||||||
|
|
||||||
if [[ $linux_platform_name == "rhel.6" ]]; then
|
if [ "$linux_platform_name" = "rhel.6" ]; then
|
||||||
echo $linux_platform_name
|
echo $linux_platform_name
|
||||||
return 0
|
return 0
|
||||||
elif [[ $linux_platform_name == alpine* ]]; then
|
elif is_musl_based_distro; then
|
||||||
echo "linux-musl"
|
echo "linux-musl"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@@ -202,7 +206,7 @@ get_legacy_os_name() {
|
|||||||
else
|
else
|
||||||
if [ -e /etc/os-release ]; then
|
if [ -e /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
os=$(get_legacy_os_name_from_platform "$ID.$VERSION_ID" || echo "")
|
os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "")
|
||||||
if [ -n "$os" ]; then
|
if [ -n "$os" ]; then
|
||||||
echo "$os"
|
echo "$os"
|
||||||
return 0
|
return 0
|
||||||
@@ -245,20 +249,29 @@ check_pre_reqs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uname)" = "Linux" ]; then
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
|
if is_musl_based_distro; then
|
||||||
|
if ! command -v scanelf > /dev/null; then
|
||||||
|
say_warning "scanelf not found, please install pax-utils package."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
LDCONFIG_COMMAND="scanelf --ldpath -BF '%f'"
|
||||||
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libintl)" ] && say_warning "Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)."
|
||||||
|
else
|
||||||
if [ ! -x "$(command -v ldconfig)" ]; then
|
if [ ! -x "$(command -v ldconfig)" ]; then
|
||||||
echo "ldconfig is not in PATH, trying /sbin/ldconfig."
|
say_verbose "ldconfig is not in PATH, trying /sbin/ldconfig."
|
||||||
LDCONFIG_COMMAND="/sbin/ldconfig"
|
LDCONFIG_COMMAND="/sbin/ldconfig"
|
||||||
else
|
else
|
||||||
LDCONFIG_COMMAND="ldconfig"
|
LDCONFIG_COMMAND="ldconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local librarypath=${LD_LIBRARY_PATH:-}
|
local librarypath=${LD_LIBRARY_PATH:-}
|
||||||
LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
|
LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
|
||||||
|
fi
|
||||||
|
|
||||||
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libunwind)" ] && say_warning "Unable to locate libunwind. Probable prerequisite missing; install libunwind."
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep zlib)" ] && say_warning "Unable to locate zlib. Probable prerequisite missing; install zlib."
|
||||||
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep ssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
|
||||||
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu."
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu."
|
||||||
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep -F libcurl.so)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep lttng)" ] && say_warning "Unable to locate liblttng. Probable prerequisite missing; install libcurl."
|
||||||
|
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libcurl)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -360,7 +373,7 @@ get_normalized_architecture_from_architecture() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/cli/issues"
|
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,6 +484,7 @@ parse_jsonfile_for_version() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset IFS;
|
||||||
echo "$version_info"
|
echo "$version_info"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -631,7 +645,7 @@ copy_files_or_dirs_from_list() {
|
|||||||
local osname="$(get_current_os_name)"
|
local osname="$(get_current_os_name)"
|
||||||
local override_switch=$(
|
local override_switch=$(
|
||||||
if [ "$override" = false ]; then
|
if [ "$override" = false ]; then
|
||||||
if [[ "$osname" == "linux-musl" ]]; then
|
if [ "$osname" = "linux-musl" ]; then
|
||||||
printf -- "-u";
|
printf -- "-u";
|
||||||
else
|
else
|
||||||
printf -- "-n";
|
printf -- "-n";
|
||||||
@@ -840,8 +854,26 @@ install_dotnet() {
|
|||||||
say "Extracting zip from $download_link"
|
say "Extracting zip from $download_link"
|
||||||
extract_dotnet_package "$zip_path" "$install_root"
|
extract_dotnet_package "$zip_path" "$install_root"
|
||||||
|
|
||||||
# Check if the SDK version is now installed; if not, fail the installation.
|
# Check if the SDK version is installed; if not, fail the installation.
|
||||||
if ! is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
|
is_asset_installed=false
|
||||||
|
|
||||||
|
# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
|
||||||
|
if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then
|
||||||
|
IFS='-'
|
||||||
|
read -ra verArr <<< "$specific_version"
|
||||||
|
release_version="${verArr[0]}"
|
||||||
|
unset IFS;
|
||||||
|
say_verbose "Checking installation: version = $release_version"
|
||||||
|
is_asset_installed="$(is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the SDK version is installed.
|
||||||
|
if [ "$is_asset_installed" = false ]; then
|
||||||
|
say_verbose "Checking installation: version = $specific_version"
|
||||||
|
is_asset_installed="$(is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_asset_installed" = false ]; then
|
||||||
say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
|
say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user