mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 15:20:51 +00:00
fix: restore Unicode characters in PowerShell installer
This commit is contained in:
26
dcrup.ps1
26
dcrup.ps1
@@ -19,7 +19,7 @@ function Die($m) { Write-Host "[error] $m" -ForegroundColor Red; exit 1 }
|
|||||||
|
|
||||||
function Show-Usage {
|
function Show-Usage {
|
||||||
@'
|
@'
|
||||||
dcrup - install and switch DCR versions (Windows)
|
dcrup — install and switch DCR versions (Windows)
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
dcrup install <spec> [--build|--release] [--force] [--mirror auto|cf|gh|sf|ya]
|
dcrup install <spec> [--build|--release] [--force] [--mirror auto|cf|gh|sf|ya]
|
||||||
@@ -34,10 +34,10 @@ Usage:
|
|||||||
|
|
||||||
Spec:
|
Spec:
|
||||||
stable | dev | night
|
stable | dev | night
|
||||||
VERSION в†’ VERSION@stable (e.g. 0.8.2)
|
VERSION → VERSION@stable (e.g. 0.8.2)
|
||||||
VERSION@stable
|
VERSION@stable
|
||||||
VERSION@dev
|
VERSION@dev
|
||||||
night в†’ always build from branch "dev" HEAD
|
night → always build from branch "dev" HEAD
|
||||||
|
|
||||||
Modes:
|
Modes:
|
||||||
--release download prebuilt binary (default for stable/dev)
|
--release download prebuilt binary (default for stable/dev)
|
||||||
@@ -45,7 +45,7 @@ Modes:
|
|||||||
night always --build (prebuilt not available)
|
night always --build (prebuilt not available)
|
||||||
|
|
||||||
Mirrors (prebuilt download only):
|
Mirrors (prebuilt download only):
|
||||||
--mirror auto try cf в†’ gh в†’ sf в†’ ya, first successful download wins (default)
|
--mirror auto try cf → gh → sf → ya, first successful download wins (default)
|
||||||
--mirror cf download from cdn-global.dcr-tool.ru
|
--mirror cf download from cdn-global.dcr-tool.ru
|
||||||
--mirror gh download from github.com/dexoron/dcr
|
--mirror gh download from github.com/dexoron/dcr
|
||||||
--mirror sf download from sourceforge.net/projects/dcr-tool
|
--mirror sf download from sourceforge.net/projects/dcr-tool
|
||||||
@@ -131,7 +131,7 @@ function Link-Default([string]$id) {
|
|||||||
$dst = Join-Path $DcrupBin 'dcr.exe'
|
$dst = Join-Path $DcrupBin 'dcr.exe'
|
||||||
Copy-Item $src $dst -Force
|
Copy-Item $src $dst -Force
|
||||||
Write-Active $id
|
Write-Active $id
|
||||||
Ok "default в†’ $id ($dst)"
|
Ok "default → $id ($dst)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Resolve-InstalledId([string]$spec) {
|
function Resolve-InstalledId([string]$spec) {
|
||||||
@@ -175,7 +175,7 @@ function Download-FromMirrors([string]$tag, [string]$asset, [string]$destFile) {
|
|||||||
$tmp = "$destFile.download"
|
$tmp = "$destFile.download"
|
||||||
foreach ($m in (Get-MirrorsToTry)) {
|
foreach ($m in (Get-MirrorsToTry)) {
|
||||||
$url = Get-MirrorUrl $m $tag $asset
|
$url = Get-MirrorUrl $m $tag $asset
|
||||||
Info "trying mirror $m …"
|
Info "trying mirror $m …"
|
||||||
Remove-Item $tmp -ErrorAction SilentlyContinue
|
Remove-Item $tmp -ErrorAction SilentlyContinue
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -Uri $url -OutFile $tmp -UserAgent 'dcrup'
|
Invoke-WebRequest -Uri $url -OutFile $tmp -UserAgent 'dcrup'
|
||||||
@@ -223,10 +223,10 @@ function Install-Prebuilt([switch]$Force) {
|
|||||||
}
|
}
|
||||||
Ensure-Dirs
|
Ensure-Dirs
|
||||||
New-Item -ItemType Directory -Force -Path $dest | Out-Null
|
New-Item -ItemType Directory -Force -Path $dest | Out-Null
|
||||||
Info "downloading $assetName (mirror=$($script:DcrupMirror)) …"
|
Info "downloading $assetName (mirror=$($script:DcrupMirror)) …"
|
||||||
$mirror = Download-FromMirrors $tag $assetName $bin
|
$mirror = Download-FromMirrors $tag $assetName $bin
|
||||||
if (-not $mirror) { Die "no mirror reachable for $assetName (try: --mirror cf|gh|sf|ya)" }
|
if (-not $mirror) { Die "no mirror reachable for $assetName (try: --mirror cf|gh|sf|ya)" }
|
||||||
Info "mirror в†’ $mirror"
|
Info "mirror → $mirror"
|
||||||
@"
|
@"
|
||||||
channel=$($script:SpecChannel)
|
channel=$($script:SpecChannel)
|
||||||
version=$ver
|
version=$ver
|
||||||
@@ -248,7 +248,7 @@ function Install-Build([switch]$Force) {
|
|||||||
try {
|
try {
|
||||||
$src = Join-Path $tmp 'src'
|
$src = Join-Path $tmp 'src'
|
||||||
if ($script:SpecChannel -eq 'night') {
|
if ($script:SpecChannel -eq 'night') {
|
||||||
Info "cloning dev for night …"
|
Info "cloning dev for night …"
|
||||||
git clone --depth 1 --branch dev $RepoUrl $src 2>$null
|
git clone --depth 1 --branch dev $RepoUrl $src 2>$null
|
||||||
if ($LASTEXITCODE -ne 0) { git clone --depth 1 $RepoUrl $src | Out-Null }
|
if ($LASTEXITCODE -ne 0) { git clone --depth 1 $RepoUrl $src | Out-Null }
|
||||||
$sha = (git -C $src rev-parse --short HEAD).Trim()
|
$sha = (git -C $src rev-parse --short HEAD).Trim()
|
||||||
@@ -259,7 +259,7 @@ function Install-Build([switch]$Force) {
|
|||||||
$tag = $rel.tag_name
|
$tag = $rel.tag_name
|
||||||
$ver = Normalize-Version $tag
|
$ver = Normalize-Version $tag
|
||||||
$id = Toolchain-Id $ver
|
$id = Toolchain-Id $ver
|
||||||
Info "cloning $tag …"
|
Info "cloning $tag …"
|
||||||
git clone --depth 1 --branch $tag $RepoUrl $src 2>$null
|
git clone --depth 1 --branch $tag $RepoUrl $src 2>$null
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
git clone --depth 1 $RepoUrl $src | Out-Null
|
git clone --depth 1 $RepoUrl $src | Out-Null
|
||||||
@@ -271,7 +271,7 @@ function Install-Build([switch]$Force) {
|
|||||||
$tag = "v$($script:SpecVersion)"
|
$tag = "v$($script:SpecVersion)"
|
||||||
$ver = $script:SpecVersion
|
$ver = $script:SpecVersion
|
||||||
$id = Toolchain-Id
|
$id = Toolchain-Id
|
||||||
Info "cloning $tag …"
|
Info "cloning $tag …"
|
||||||
git clone --depth 1 --branch $tag $RepoUrl $src 2>$null
|
git clone --depth 1 --branch $tag $RepoUrl $src 2>$null
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
git clone --depth 1 $RepoUrl $src | Out-Null
|
git clone --depth 1 $RepoUrl $src | Out-Null
|
||||||
@@ -290,7 +290,7 @@ function Install-Build([switch]$Force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$triple = Get-Target
|
$triple = Get-Target
|
||||||
Info "building release (features: $Features) …"
|
Info "building release (features: $Features) …"
|
||||||
Push-Location $src
|
Push-Location $src
|
||||||
cargo build --release --features $Features --target $triple
|
cargo build --release --features $Features --target $triple
|
||||||
if ($LASTEXITCODE -ne 0) { Die 'cargo build failed' }
|
if ($LASTEXITCODE -ne 0) { Die 'cargo build failed' }
|
||||||
@@ -407,7 +407,7 @@ function Cmd-SelfInstall {
|
|||||||
}
|
}
|
||||||
Install-CmdShim
|
Install-CmdShim
|
||||||
Ensure-UserPath
|
Ensure-UserPath
|
||||||
Ok "dcrup installed to $DcrupBin (use: dcrup …)"
|
Ok "dcrup installed to $DcrupBin (use: dcrup …)"
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = if ($args.Count -ge 1) { $args[0] } else { 'help' }
|
$cmd = if ($args.Count -ge 1) { $args[0] } else { 'help' }
|
||||||
|
|||||||
Reference in New Issue
Block a user