You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
82
external/linker/corebuild/bootstrap.ps1
vendored
Normal file
82
external/linker/corebuild/bootstrap.ps1
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory=$false)][string]$RepositoryRoot = $PSScriptRoot,
|
||||
[Parameter(Mandatory=$false)][string]$ToolsLocalPath = (Join-Path $RepositoryRoot "Tools"),
|
||||
[Parameter(Mandatory=$false)][string]$CliLocalPath = (Join-Path $ToolsLocalPath "dotnetcli"),
|
||||
[Parameter(Mandatory=$false)][string]$SharedFrameworkSymlinkPath = (Join-Path $ToolsLocalPath "dotnetcli\shared\Microsoft.NETCore.App\version"),
|
||||
[Parameter(Mandatory=$false)][string]$SharedFrameworkVersion = "<auto>",
|
||||
[Parameter(Mandatory=$false)][string]$Architecture = "<auto>",
|
||||
[Parameter(Mandatory=$false)][string]$DotNetInstallBranch = "rel/1.0.0",
|
||||
[switch]$Force = $false
|
||||
)
|
||||
|
||||
$rootCliVersion = Join-Path $RepositoryRoot ".cliversion"
|
||||
$bootstrapComplete = Join-Path $ToolsLocalPath "bootstrap.complete"
|
||||
|
||||
# if the force switch is specified delete the semaphore file if it exists
|
||||
if ($Force -and (Test-Path $bootstrapComplete))
|
||||
{
|
||||
del $bootstrapComplete
|
||||
}
|
||||
|
||||
# if the semaphore file exists and is identical to the specified version then exit
|
||||
if ((Test-Path $bootstrapComplete) -and !(Compare-Object (Get-Content $rootCliVersion) (Get-Content $bootstrapComplete)))
|
||||
{
|
||||
exit 0
|
||||
}
|
||||
|
||||
$initCliScript = "dotnet-install.ps1"
|
||||
$dotnetInstallPath = Join-Path $ToolsLocalPath $initCliScript
|
||||
|
||||
# blow away the tools directory so we can start from a known state
|
||||
if (Test-Path $ToolsLocalPath)
|
||||
{
|
||||
# if the bootstrap.ps1 script was downloaded to the tools directory don't delete it
|
||||
rd -recurse -force $ToolsLocalPath -exclude "bootstrap.ps1"
|
||||
}
|
||||
else
|
||||
{
|
||||
mkdir $ToolsLocalPath | Out-Null
|
||||
}
|
||||
|
||||
# download CLI boot-strapper script
|
||||
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/$DotNetInstallBranch/scripts/obtain/dotnet-install.ps1" -OutFile $dotnetInstallPath
|
||||
|
||||
# load the version of the CLI
|
||||
$dotNetCliVersion = Get-Content $rootCliVersion
|
||||
|
||||
if (-Not (Test-Path $CliLocalPath))
|
||||
{
|
||||
mkdir $CliLocalPath | Out-Null
|
||||
}
|
||||
|
||||
# now execute the script
|
||||
Write-Host "$dotnetInstallPath -Version $dotNetCliVersion -InstallDir $CliLocalPath -Architecture ""$Architecture"""
|
||||
Invoke-Expression "$dotnetInstallPath -Version $dotNetCliVersion -InstallDir $CliLocalPath -Architecture ""$Architecture"""
|
||||
if ($LastExitCode -ne 0)
|
||||
{
|
||||
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
# create a junction to the shared FX version directory. this is
|
||||
# so we have a stable path to dotnet.exe regardless of version.
|
||||
$runtimesPath = Join-Path $CliLocalPath "shared\Microsoft.NETCore.App"
|
||||
if ($SharedFrameworkVersion -eq "<auto>")
|
||||
{
|
||||
$SharedFrameworkVersion = Get-ChildItem $runtimesPath -Directory | Sort-Object | Select-Object -First 1 | % { New-Object System.Version($_) }
|
||||
}
|
||||
$junctionTarget = Join-Path $runtimesPath $SharedFrameworkVersion
|
||||
$junctionParent = Split-Path $SharedFrameworkSymlinkPath -Parent
|
||||
if (-Not (Test-Path $junctionParent))
|
||||
{
|
||||
mkdir $junctionParent | Out-Null
|
||||
}
|
||||
if (-Not (Test-Path $SharedFrameworkSymlinkPath))
|
||||
{
|
||||
cmd.exe /c mklink /j $SharedFrameworkSymlinkPath $junctionTarget | Out-Null
|
||||
}
|
||||
|
||||
# write semaphore file
|
||||
copy $rootCliVersion $bootstrapComplete
|
||||
exit 0
|
Reference in New Issue
Block a user