Skip to content

Commit 8a99c72

Browse files
committed
feat: Add install script for windows.
1 parent 99b3132 commit 8a99c72

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

install.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$repo = "hamflx/fetchbrowser"
2+
$file = "fb.exe"
3+
4+
$releases = "https://api.github.com/repos/$repo/releases"
5+
6+
Write-Host Determining latest release
7+
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name
8+
9+
$download = "https://github.com/$repo/releases/download/$tag/$file"
10+
$fb_dir = "$HOME/.fb"
11+
$fb_bin_dir = "$fb_dir/bin"
12+
$fb_bin_path = "$fb_bin_dir/$file"
13+
14+
New-Item "$fb_bin_dir" -ItemType Directory -Force
15+
16+
Write-Host Dowloading latest release
17+
Invoke-WebRequest $download -Out $fb_bin_path
18+
19+
$old_path = [System.Environment]::GetEnvironmentVariable("PATH", "User")
20+
if ($old_path -notcontains $fb_bin_path) {
21+
$new_path = $old_path + [IO.Path]::PathSeparator + $fb_bin_path
22+
[Environment]::SetEnvironmentVariable("PATH", $new_path, "User")
23+
}

0 commit comments

Comments
 (0)