From 5b599f1e960014a30e7b9e901c9adb909aa19918 Mon Sep 17 00:00:00 2001 From: Akizon77 Date: Thu, 5 Jun 2025 00:51:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=8C=E6=8F=90=E5=89=8D=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E5=B9=B6=E7=AE=80=E5=8C=96=20GitHub=20?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.ps1 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/install.ps1 b/install.ps1 index bab5a5b..03876cb 100644 --- a/install.ps1 +++ b/install.ps1 @@ -31,14 +31,24 @@ if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent exit 1 } +# Prepare GitHub proxy display +if ($GitHubProxy -ne '') { $ProxyDisplay = $GitHubProxy } else { $ProxyDisplay = '(direct)' } + +# Detect architecture early for constructing binary name +switch ($env:PROCESSOR_ARCHITECTURE) { + 'AMD64' { $arch = 'amd64' } + 'ARM64' { $arch = 'arm64' } + Default { Log-Error "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE"; exit 1 } +} + Log-Step "Installation configuration:" Log-Config "Service name: $ServiceName" Log-Config "Install directory: $InstallDir" -Log-Config "GitHub proxy: $($GitHubProxy -ne '' ? $GitHubProxy : '(direct)')" +Log-Config "GitHub proxy: $ProxyDisplay" Log-Config "Agent arguments: $($KomariArgs -join ' ')" # Paths -$BinaryName = "komari-agent-windows-$((switch($env:PROCESSOR_ARCHITECTURE) { 'AMD64' { 'amd64' }; 'ARM64' { 'arm64' }; Default { '' } })) .exe".Trim() +$BinaryName = "komari-agent-windows-$arch.exe" $AgentPath = Join-Path $InstallDir $BinaryName # Uninstall previous service and binary @@ -58,14 +68,6 @@ function Uninstall-Previous { } Uninstall-Previous -# Detect architecture -switch ($env:PROCESSOR_ARCHITECTURE) { - "AMD64" { $arch = "amd64" } - "ARM64" { $arch = "arm64" } - Default { Log-Error "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE"; exit 1 } -} -Log-Info "Detected architecture: $arch" - # Fetch latest release version $ApiUrl = "https://api.github.com/repos/komari-monitor/komari-agent/releases/latest" Log-Step "Fetching latest version from GitHub API..."