agent start fix

This commit is contained in:
Frank Harris 2026-06-07 17:21:32 -05:00
parent 6a15b114e6
commit f2dbfe5e4e
10 changed files with 110 additions and 62 deletions

View file

@ -57,10 +57,17 @@ Relevant files:
The batch launcher must not assume that `bash` is in the Windows `PATH`. It explicitly checks:
- the Cygwin root beside the launcher
- `%~dp0bin\bash.exe`
- `%~dp0..\bin\bash.exe`
- `%~dp0..\..\bin\bash.exe`
- `C:\OGP64\bin\bash.exe`
- `C:\cygwin64\bin\bash.exe`
- `C:\cygwin\bin\bash.exe`
This matters because the maintained launcher may be run from `C:\OGP64\agent_start.bat` or from `C:\OGP64\OGP\Install\agent_start.bat`. In the second case the actual Cygwin root is two directories above the launcher, so `C:\OGP64\bin\bash.exe` must be checked.
Manual launches pause on fatal errors so the error remains visible. Service or scheduled-task wrappers can set `GSP_AGENT_NO_PAUSE=1` to return immediately instead of waiting forever at a `pause` prompt.
The Cygwin-side helper performs the shell work:
1. enter `/OGP`
@ -72,7 +79,8 @@ The Cygwin-side helper performs the shell work:
7. backup the current `/OGP/ogp_agent.pl`
8. validate downloaded and installed agent files with content checks plus `perl -c`
9. restore the backup if validation fails
10. launch `/OGP/ogp_agent.pl`
10. refuse to launch if `Cfg/Config.pm` still contains placeholder values
11. launch `/OGP/ogp_agent.pl`
Default optional update source:
@ -84,11 +92,13 @@ Default optional update source:
Auto-update failure is non-fatal. Missing `curl`/`git`, download failure, clone failure, missing source file, HTTP error-page downloads, empty files, or failed validation should warn and continue with the current installed agent.
Restart-time auto-update is allowlisted. It may replace only `/OGP/ogp_agent.pl`. It must never overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, generated installer config, server homes, logs, or user-created files. Broader agent updates belong to the admin-only Panel `component_update` flow, which also preserves `Cfg/`.
The Windows agent file does not use `DBI` at startup. If a Windows node reports `Can't locate DBI.pm` at line 48, it is a strong signal that a Linux agent file was copied onto the Windows node.
Required Cygwin Perl packages include `perl`, `perl_vendor`, `perl-HTTP-Daemon`, `perl-Path-Class`, `perl-XML-Parser`, `perl-XML-Simple`, `perl-Archive-Zip`, and `perl-Archive-Extract`. A clean non-Cygwin Linux workstation may fail `perl -c` on these dependencies even though the bundled Windows Cygwin tree contains them.
Default tracked config files contain placeholders only. Production installs must replace `CHANGE_ME_PANEL_AGENT_KEY`, `web_api_url`, and related values with the values configured in the Panel remote-server record.
Default tracked config template files contain placeholders only. Production installs must replace `CHANGE_ME_PANEL_AGENT_KEY`, `web_api_url`, and related values with the values configured in the Panel remote-server record. If startup creates `Config.pm` from `Config.pm.default`, it stops with a clear error until those values are changed.
## Status Logic