-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
68 lines (57 loc) · 3.1 KB
/
Copy pathinstall.ps1
File metadata and controls
68 lines (57 loc) · 3.1 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
# ==============================================================================
# ⚡ TailRouter - Windows Smart Installer
# Auto-downloads and installs TailRouter Native Engine, creates shortcut & autostart.
# ==============================================================================
param(
[string]$Tag = "v2.0.1"
)
$Repo = "giangsamne/TailRouter"
$ReleaseTag = $Tag
$ArchiveName = "TailRouter-Windows.zip"
$DownloadUrl = "https://github.com/$Repo/releases/download/$ReleaseTag/$ArchiveName"
$InstallDir = "$env:LOCALAPPDATA\TailRouter"
$TempZip = "$env:TEMP\TailRouter-Windows.zip"
Write-Host "==========================================================" -ForegroundColor Cyan
Write-Host "⚡ TailRouter Windows Installer ($ReleaseTag)" -ForegroundColor Cyan
Write-Host "==========================================================" -ForegroundColor Cyan
# 1. Stop running processes
Write-Host "==> [1/4] Stopping existing TailRouter processes if any..." -ForegroundColor Yellow
Stop-Process -Name "tailrouter" -ErrorAction SilentlyContinue
Stop-Process -Name "TailRouter" -ErrorAction SilentlyContinue
Start-Sleep -Seconds 1
# 2. Download release
Write-Host "==> [2/4] Downloading $ArchiveName from GitHub Releases..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $DownloadUrl -OutFile $TempZip -UseBasicParsing
# 3. Extract and install
Write-Host "==> [3/4] Installing to $InstallDir..." -ForegroundColor Yellow
if (!(Test-Path -Path $InstallDir)) {
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}
Expand-Archive -Path $TempZip -DestinationPath $InstallDir -Force
Remove-Item -Path $TempZip -Force
# 4. Create Desktop Shortcut and Startup Registry
Write-Host "==> [4/4] Setting up PATH and Autostart..." -ForegroundColor Yellow
$WshShell = New-Object -ComObject WScript.Shell
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$Shortcut = $WshShell.CreateShortcut("$DesktopPath\TailRouter.lnk")
$Shortcut.TargetPath = "$InstallDir\tailrouter.exe"
$Shortcut.Arguments = ""
$Shortcut.WorkingDirectory = $InstallDir
$Shortcut.Description = "TailRouter - High-Performance Bare-Metal Gateway"
$Shortcut.Save()
# Autostart on Windows Logon
$StartupKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
Set-ItemProperty -Path $StartupKey -Name "TailRouter" -Value "`"$InstallDir\tailrouter.exe`" run" -Force
# Add InstallDir to User PATH if not present
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($UserPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User")
}
Write-Host "==========================================================" -ForegroundColor Green
Write-Host "✅ TailRouter installed successfully to $InstallDir!" -ForegroundColor Green
Write-Host "==> Starting TailRouter Gateway..." -ForegroundColor Cyan
Start-Process -FilePath "$InstallDir\tailrouter.exe" -ArgumentList "run"
Start-Sleep -Seconds 1
Start-Process "http://localhost:65534"
Write-Host "💡 Web Dashboard accessible at: http://localhost:65534" -ForegroundColor Cyan
Write-Host "==========================================================" -ForegroundColor Green