feat: add arch detection (x32=sciter, x64=normal), update to 1.4.6
This commit is contained in:
parent
333b8d46a6
commit
3d3f0d35b8
42
rd_setup.ps1
42
rd_setup.ps1
|
|
@ -33,23 +33,53 @@ Write-Host "[2/5] Download and install RustDesk..." -ForegroundColor Yellow
|
||||||
|
|
||||||
New-Item -ItemType Directory -Path $temp -Force | Out-Null
|
New-Item -ItemType Directory -Path $temp -Force | Out-Null
|
||||||
|
|
||||||
|
# Opredelyaem razryadnost sistemy
|
||||||
|
$arch = (Get-WmiObject -Class Win32_OperatingSystem -ErrorAction SilentlyContinue).OSArchitecture
|
||||||
|
if ($arch -match "32") {
|
||||||
|
$isX86 = $true
|
||||||
|
Write-Host " Architecture: x86 (32-bit)" -ForegroundColor Gray
|
||||||
|
} else {
|
||||||
|
$isX86 = $false
|
||||||
|
Write-Host " Architecture: x64 (64-bit)" -ForegroundColor Gray
|
||||||
|
}
|
||||||
|
|
||||||
# Nahodim fayl RustDesk v repo cherez API
|
# Nahodim fayl RustDesk v repo cherez API
|
||||||
$repoApi = "$($repo -replace '/raw/branch/main', '')/api/v1/repos/helmut/auto-turning/contents/installers"
|
$repoApi = "$($repo -replace '/raw/branch/main', '')/api/v1/repos/helmut/auto-turning/contents/installers"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = Invoke-WebRequest -Uri $repoApi -ErrorAction Stop
|
$response = Invoke-WebRequest -Uri $repoApi -ErrorAction Stop
|
||||||
$files = ($response.Content | ConvertFrom-Json) | Where-Object { $_.type -eq "file" -and $_.name -match "rustdesk" }
|
$allFiles = ($response.Content | ConvertFrom-Json) | Where-Object { $_.type -eq "file" }
|
||||||
|
|
||||||
if ($files.Count -eq 0) {
|
# Vibiraem nuzhnyj fayl po arhitekture
|
||||||
|
if ($isX86) {
|
||||||
|
# Dlya 32-bit: sciter versiya
|
||||||
|
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86.*sciter" } | Select-Object -First 1).name
|
||||||
|
if (-not $rdFile) {
|
||||||
|
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86" } | Select-Object -First 1).name
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# Dlya 64-bit: x86_64 versiya
|
||||||
|
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86_64" } | Select-Object -First 1).name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $rdFile) {
|
||||||
|
# Fallback: lyuboy rustdesk fayl
|
||||||
|
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk" } | Select-Object -First 1).name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $rdFile) {
|
||||||
Write-Host " RustDesk installer NOT found in repo" -ForegroundColor Red
|
Write-Host " RustDesk installer NOT found in repo" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$rdFile = $files[0].name
|
Write-Host " Selected: $rdFile" -ForegroundColor Green
|
||||||
Write-Host " Found: $rdFile" -ForegroundColor Green
|
|
||||||
} catch {
|
} catch {
|
||||||
# Fallback: esli API nedostupen, ishem lokalno ili po imeni
|
# Fallback: esli API nedostupen
|
||||||
$rdFile = "Rustdesk-1.4.4-x86_64.exe"
|
if ($isX86) {
|
||||||
|
$rdFile = "rustdesk-1.4.6-x86-sciter.exe"
|
||||||
|
} else {
|
||||||
|
$rdFile = "rustdesk-1.4.6-x86_64.exe"
|
||||||
|
}
|
||||||
Write-Host " Using default: $rdFile" -ForegroundColor Yellow
|
Write-Host " Using default: $rdFile" -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue