fix: Atera bundled MSI, remove --resume flag, CI CGo+MinGW
All checks were successful
release / build-and-release (push) Successful in 30s
All checks were successful
release / build-and-release (push) Successful in 30s
Atera agent: download URL requires MFA in browser session, so Invoke-WebRequest gets HTML instead of MSI. Changed to bundled MSI from assets/Atera/ - download once from dashboard, no network dependency. Graceful skip with log message when MSI not present. Removed unused --resume argument from X9-Resume scheduled task registration. Resume is detected via state file, not CLI flag. CI pipeline: added mingw-w64-gcc and CGO_ENABLED=1 for Walk cross-compilation (required since Walk migration from Fyne). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2f0e176e82
commit
0d46b0dc4b
4 changed files with 36 additions and 28 deletions
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
- name: Setup
|
- name: Setup
|
||||||
working-directory: /
|
working-directory: /
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache git curl jq
|
apk add --no-cache git curl jq mingw-w64-gcc
|
||||||
git clone --depth=1 \
|
git clone --depth=1 \
|
||||||
"http://x9:${{ secrets.FORGEJO_TOKEN }}@xetup-forgejo:3000/${{ github.repository }}.git" \
|
"http://x9:${{ secrets.FORGEJO_TOKEN }}@xetup-forgejo:3000/${{ github.repository }}.git" \
|
||||||
/repo
|
/repo
|
||||||
|
|
@ -41,7 +41,8 @@ jobs:
|
||||||
|
|
||||||
- name: Build xetup.exe
|
- name: Build xetup.exe
|
||||||
run: |
|
run: |
|
||||||
GOOS=windows GOARCH=amd64 \
|
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
|
||||||
|
GOOS=windows GOARCH=amd64 \
|
||||||
go build -ldflags="-s -w -H windowsgui" -o xetup.exe ./cmd/xetup/
|
go build -ldflags="-s -w -H windowsgui" -o xetup.exe ./cmd/xetup/
|
||||||
echo "Built: $(ls -lh xetup.exe | awk '{print $5}')"
|
echo "Built: $(ls -lh xetup.exe | awk '{print $5}')"
|
||||||
|
|
||||||
|
|
|
||||||
0
assets/Atera/.gitkeep
Normal file
0
assets/Atera/.gitkeep
Normal file
|
|
@ -158,8 +158,9 @@ func disableAutologon() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerResumeTask() error {
|
func registerResumeTask() error {
|
||||||
|
// No arguments needed - xetup detects resume mode via state file presence.
|
||||||
ps := fmt.Sprintf(`
|
ps := fmt.Sprintf(`
|
||||||
$action = New-ScheduledTaskAction -Execute '%s' -Argument '--resume'
|
$action = New-ScheduledTaskAction -Execute '%s'
|
||||||
$trigger = New-ScheduledTaskTrigger -AtLogOn -User '%s'
|
$trigger = New-ScheduledTaskTrigger -AtLogOn -User '%s'
|
||||||
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Hours 4) -MultipleInstances IgnoreNew
|
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Hours 4) -MultipleInstances IgnoreNew
|
||||||
$principal = New-ScheduledTaskPrincipal -UserId '%s' -LogonType Interactive -RunLevel Highest
|
$principal = New-ScheduledTaskPrincipal -UserId '%s' -LogonType Interactive -RunLevel Highest
|
||||||
|
|
|
||||||
|
|
@ -185,40 +185,46 @@ if (Get-Feature $Config "software" "pdfDefault") {
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# Install Atera RMM Agent
|
# Install Atera RMM Agent
|
||||||
|
# The MSI is bundled in assets/Atera/ (downloaded once from the Atera
|
||||||
|
# dashboard). The download URL requires MFA in a browser session, so
|
||||||
|
# Invoke-WebRequest gets an HTML login page instead of the MSI binary.
|
||||||
|
# Bundling avoids this entirely - no network dependency for Atera.
|
||||||
|
# To update: download fresh MSI from Atera dashboard, replace in assets/.
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
if (Get-Feature $Config "software" "ateraAgent") {
|
if (Get-Feature $Config "software" "ateraAgent") {
|
||||||
Write-Log "Installing Atera RMM Agent" -Level INFO
|
Write-Log "Installing Atera RMM Agent" -Level INFO
|
||||||
|
|
||||||
$ateraUrl = "https://x9.servicedesk.atera.com/api/utils/agent-install/windows/?cid=31&aeid=50b72e7113e54a63ac76b96c54c7e337"
|
# Look for bundled MSI in assets/Atera/
|
||||||
$ateraMsi = "$env:TEMP\AteraAgent.msi"
|
$ateraAssetsDir = Join-Path $PSScriptRoot "..\assets\Atera"
|
||||||
|
$ateraMsi = Get-ChildItem -Path $ateraAssetsDir -Filter "*.msi" -ErrorAction SilentlyContinue |
|
||||||
|
Select-Object -First 1
|
||||||
|
|
||||||
try {
|
if (-not $ateraMsi) {
|
||||||
Write-Log " Downloading Atera agent..." -Level INFO
|
Write-Log " No Atera MSI found in assets/Atera/ - skipping" -Level WARN
|
||||||
Invoke-WebRequest -Uri $ateraUrl -OutFile $ateraMsi -UseBasicParsing -ErrorAction Stop
|
Write-Log " Download MSI from Atera dashboard and place in assets/Atera/" -Level WARN
|
||||||
Write-Log " Download complete" -Level OK
|
} else {
|
||||||
|
Write-Log " Using bundled MSI: $($ateraMsi.Name)" -Level INFO
|
||||||
|
try {
|
||||||
|
$msiProc = Start-Process msiexec -ArgumentList "/i `"$($ateraMsi.FullName)`" /qn" -Wait -PassThru
|
||||||
|
if ($msiProc.ExitCode -eq 0) {
|
||||||
|
Write-Log " Atera agent installed (msiexec exit 0)" -Level OK
|
||||||
|
} else {
|
||||||
|
Write-Log " Atera agent install exit code: $($msiProc.ExitCode)" -Level WARN
|
||||||
|
}
|
||||||
|
|
||||||
$msiProc = Start-Process msiexec -ArgumentList "/i `"$ateraMsi`" /qn" -Wait -PassThru
|
# Verify binary exists
|
||||||
if ($msiProc.ExitCode -eq 0) {
|
$ateraExe = "$env:ProgramFiles\ATERA Networks\AteraAgent\AteraAgent.exe"
|
||||||
Write-Log " Atera agent installed (msiexec exit 0)" -Level OK
|
$ateraExe86 = "${env:ProgramFiles(x86)}\ATERA Networks\AteraAgent\AteraAgent.exe"
|
||||||
} else {
|
if ((Test-Path $ateraExe) -or (Test-Path $ateraExe86)) {
|
||||||
Write-Log " Atera agent install exit code: $($msiProc.ExitCode)" -Level WARN
|
Write-Log " Atera agent binary verified" -Level OK
|
||||||
|
} else {
|
||||||
|
Write-Log " Atera agent binary not found at expected paths" -Level WARN
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch {
|
||||||
# Verify binary exists
|
Write-Log " Atera agent install failed: $_" -Level ERROR
|
||||||
$ateraExe = "$env:ProgramFiles\ATERA Networks\AteraAgent\AteraAgent.exe"
|
|
||||||
$ateraExe86 = "${env:ProgramFiles(x86)}\ATERA Networks\AteraAgent\AteraAgent.exe"
|
|
||||||
if ((Test-Path $ateraExe) -or (Test-Path $ateraExe86)) {
|
|
||||||
Write-Log " Atera agent binary verified" -Level OK
|
|
||||||
} else {
|
|
||||||
Write-Log " Atera agent binary not found at expected paths" -Level WARN
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
|
||||||
Write-Log " Atera agent download/install failed: $_" -Level ERROR
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
Remove-Item $ateraMsi -Force -ErrorAction SilentlyContinue
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Write-Log "ateraAgent feature disabled - skipping" -Level INFO
|
Write-Log "ateraAgent feature disabled - skipping" -Level INFO
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue