зеркало из https://github.com/dotnet/sdk.git
Modify the post install check to include a 'release-type' version format
This commit is contained in:
Родитель
b5059ac44d
Коммит
78d1d208e2
|
@ -309,14 +309,12 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
|
|||
|
||||
If (-Not (Test-Path $JSonFile)) {
|
||||
throw "Unable to find '$JSonFile'"
|
||||
exit 0
|
||||
}
|
||||
try {
|
||||
$JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue
|
||||
}
|
||||
catch {
|
||||
throw "Json file unreadable: '$JSonFile'"
|
||||
exit 0
|
||||
}
|
||||
if ($JSonContent) {
|
||||
try {
|
||||
|
@ -330,16 +328,13 @@ function Parse-Jsonfile-For-Version([string]$JSonFile) {
|
|||
}
|
||||
catch {
|
||||
throw "Unable to parse the SDK node in '$JSonFile'"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw "Unable to find the SDK node in '$JSonFile'"
|
||||
exit 0
|
||||
}
|
||||
If ($Version -eq $null) {
|
||||
throw "Unable to find the SDK:version node in '$JSonFile'"
|
||||
exit 0
|
||||
}
|
||||
return $Version
|
||||
}
|
||||
|
@ -430,7 +425,7 @@ function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePath
|
|||
Say-Invocation $MyInvocation
|
||||
|
||||
$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
|
||||
}
|
||||
|
||||
|
@ -663,8 +658,22 @@ if ($DownloadFailed) {
|
|||
Say "Extracting zip from $DownloadLink"
|
||||
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
|
||||
|
||||
# Check if the SDK version is now installed; if not, fail the installation.
|
||||
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
|
||||
# Check if the SDK version is installed; if not, fail the installation.
|
||||
$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) {
|
||||
throw "`"$assetName`" with version = $SpecificVersion failed to install with an unknown error."
|
||||
}
|
||||
|
|
|
@ -484,6 +484,7 @@ parse_jsonfile_for_version() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
unset IFS;
|
||||
echo "$version_info"
|
||||
return 0
|
||||
}
|
||||
|
@ -853,8 +854,26 @@ install_dotnet() {
|
|||
say "Extracting zip from $download_link"
|
||||
extract_dotnet_package "$zip_path" "$install_root"
|
||||
|
||||
# Check if the SDK version is now installed; if not, fail the installation.
|
||||
if ! is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
|
||||
# Check if the SDK version is installed; if not, fail the installation.
|
||||
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."
|
||||
return 1
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче