This repository was archived by the owner on Mar 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
95 lines (84 loc) · 2.66 KB
/
install.ps1
File metadata and controls
95 lines (84 loc) · 2.66 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
param(
[string]$Version = ""
)
# 1. Setup Global Variables
$Repo = "GalaxyHaze/Kalidous"
$ApiUrl = "https://api.github.com/repos/$Repo/releases/latest"
# 2. Determine Version
if ( [string]::IsNullOrWhiteSpace($Version))
{
Write-Host "No version specified. Fetching latest version..."
try
{
$Response = Invoke-RestMethod -Uri $ApiUrl
$Version = $Response.tag_name
Write-Host "Latest version found: $Version" -ForegroundColor Green
}
catch
{
Write-Error "Failed to fetch latest version from GitHub. Check your internet connection."
exit 1
}
}
else
{
Write-Host "Installing requested version: $Version" -ForegroundColor Yellow
}
# 3. Detect OS and Architecture
# Windows is usually AMD64, but we check just in case
$FileName = ""
$IsWindow = $true
if ($IsWindow)
{
$FileName = "kalidous-windows-amd64.exe"
}
else
{
# Fallback (shouldn't happen on PS, but good practice)
Write-Error "Unsupported Operating System."
exit 1
}
# 4. Setup Download URL and Destination
$DownloadUrl = "https://github.com/$Repo/releases/download/$Version/$FileName"
# We download to the temp folder first to avoid permission issues
$TempPath = "$env:TEMP\kalidous-installer.exe"
# Final destination (e.g. C:\Users\You\AppData\Local\Microsoft\WindowsApps)
# Note: Sometimes WindowsApps is write-protected. ProgramData is often safer for tools,
# but we'll try CurrentUser AppData first.
$InstallDir = "$env:LOCALAPPDATA\Microsoft\WindowsApps"
# 5. Download the binary
Write-Host "Downloading from $DownloadUrl..." -ForegroundColor Cyan
try
{
# -UseBasicParsing is essential to avoid errors in server environments
Invoke-WebRequest -Uri $DownloadUrl -OutFile $TempPath -UseBasicParsing
}
catch
{
Write-Error "Failed to download file. The version '$Version' might not exist."
exit 1
}
# 6. Install
Write-Host "Installing Kalidous to $InstallDir..."
try
{
# Ensure the directory exists
if (-not (Test-Path $InstallDir))
{
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}
# Move the file
Move-Item -Path $TempPath -Destination "$InstallDir\kalidous.exe" -Force
Write-Host "--------------------------------------------------"
Write-Host "Installation Complete!" -ForegroundColor Green
Write-Host "Run 'kalidous --help' in a NEW terminal window to get started."
Write-Host "--------------------------------------------------"
}
catch
{
Write-Error "Failed to move file to $InstallDir."
Write-Host "You might need to run PowerShell as Administrator, or manually move the file from:"
Write-Host "$TempPath"
Write-Host "to a folder in your PATH."
exit 1
}