-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
54 lines (46 loc) · 1.53 KB
/
Copy pathinstall.ps1
File metadata and controls
54 lines (46 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
param(
[Alias("d")]
[string]$Dir = $null
)
$ErrorActionPreference = "Stop"
$RepoUrl = "https://github.com/askac/standterm.git"
if ([string]::IsNullOrWhiteSpace($Dir)) {
if ($env:STANDTERM_DIR) {
$InstallDir = $env:STANDTERM_DIR
} else {
$CurrentDir = (Get-Location).ProviderPath
if ([string]::IsNullOrWhiteSpace($CurrentDir)) {
$CurrentDir = (Get-Location).Path
}
$InstallDir = Join-Path $CurrentDir "standterm"
}
} else {
$InstallDir = $Dir
}
Write-Host "========================================"
Write-Host " StandTerm Installer (Windows)"
Write-Host "========================================"
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "[!] ERROR: git is required but not found."
Write-Host " Install with: winget install --id Git.Git -e"
exit 1
}
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Host "[*] python was not found; run.bat will try the embedded Python fallback after install."
}
if (Test-Path (Join-Path $InstallDir ".git")) {
Write-Host "[*] Existing installation found at: $InstallDir"
Write-Host "[*] Pulling latest changes..."
git -C $InstallDir pull --ff-only
} else {
Write-Host "[*] Installing to: $InstallDir"
git clone $RepoUrl $InstallDir
}
$RunBat = Join-Path $InstallDir "run.bat"
if (-not (Test-Path $RunBat)) {
Write-Host "[!] ERROR: run.bat was not found after install: $RunBat"
exit 1
}
Write-Host "[+] Done. Launching StandTerm..."
Write-Host ""
& $RunBat