-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwin_install.ps1
More file actions
36 lines (29 loc) · 909 Bytes
/
win_install.ps1
File metadata and controls
36 lines (29 loc) · 909 Bytes
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
function Install-AppStreamFile {
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Version
)
$repo = "aslamcodes/appstreamfile"
$baseUrl = "https://github.com/$repo/releases/download/$Version"
$dir = "$env:TEMP\appstreamfile"
if (!(Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir | Out-Null
}
$arch = switch ($env:PROCESSOR_ARCHITECTURE) {
"AMD64" { "x86_64" }
"x86" { "i386" }
"ARM64" { "arm64" }
default { throw "Unsupported architecture" }
}
$file = "appstreamfile_Windows_$arch.zip"
$url = "$baseUrl/$file"
$zip = Join-Path $dir $file
Write-Host "Downloading $file..."
Invoke-WebRequest $url -OutFile $zip
Expand-Archive $zip $dir -Force
Remove-Item $zip
$exe = Join-Path $dir "appstreamfile.exe"
if (!(Test-Path $exe)) { throw "Binary not found" }
Write-Host "Installation complete!"
& $exe --help
}