Commit fefa15b4 authored by Lisa's avatar Lisa

Windows installer: user-owned config (APPDATA, no admin), removed nssm...

Windows installer: user-owned config (APPDATA, no admin), removed nssm service, added user-run launcher. Build script now bundles ZIP: linux installer.sh + windows installer.exe + chrome-extension (from separate repo).
parent 6b924d1f
...@@ -238,6 +238,57 @@ makensis "$DIST_DIR/installer.nsi" 2>&1 | tail -5 ...@@ -238,6 +238,57 @@ makensis "$DIST_DIR/installer.nsi" 2>&1 | tail -5
if [ -f "$DIST_DIR/hermes-node-agent-installer.exe" ]; then if [ -f "$DIST_DIR/hermes-node-agent-installer.exe" ]; then
echo "" echo ""
# ── Step 4: Build distribution bundle ────────────────────────────────────────
echo ""
echo "Building distribution bundle..."
# Components
cd "$SCRIPT_DIR"
BUNDLE_DIR="$DIST_DIR/bundle"
rm -rf "$BUNDLE_DIR"
mkdir -p "$BUNDLE_DIR"
# Linux installer
cp ../install.sh "$BUNDLE_DIR/hermes-node-agent-linux-installer.sh"
# Windows installer
cp "$DIST_DIR/hermes-node-agent-installer.exe" "$BUNDLE_DIR/hermes-node-agent-windows-installer.exe"
# Chrome extension zip (from hermes-node-chrome repo)
EXT_ZIP="/home/lisa/hermes-node-chrome/dist/hermes-node-chrome.zip"
if [ -f "$EXT_ZIP" ]; then
cp "$EXT_ZIP" "$BUNDLE_DIR/hermes-browser-agent-chrome-extension.zip"
echo " ✓ Chrome extension zip included"
else
echo " ⚠️ Chrome extension zip not found at $EXT_ZIP"
fi
# README
if [ -f "../windows/README_BUILD.md" ]; then
cp ../windows/README_BUILD.md "$BUNDLE_DIR/README.md"
fi
# Create bundle zip
rm -f "$DIST_DIR/hermes-node-agent-bundle.zip"
(cd "$BUNDLE_DIR" && zip -r "$DIST_DIR/hermes-node-agent-bundle.zip" . > /dev/null 2>&1)
if [ -f "$DIST_DIR/hermes-node-agent-bundle.zip" ]; then
echo "✅ Distribution bundle created: $DIST_DIR/hermes-node-agent-bundle.zip"
ls -lh "$DIST_DIR/hermes-node-agent-bundle.zip"
else
echo "❌ Bundle creation failed"
exit 1
fi
# Publish locally for testing
WEB_DIR="/home/web/lisa.nexlab.net/files"
mkdir -p "$WEB_DIR"
cp "$DIST_DIR/hermes-node-agent-installer.exe" "$WEB_DIR/hermes-node-agent-installer.exe"
cp "$DIST_DIR/hermes-node-agent-bundle.zip" "$WEB_DIR/hermes-node-agent-bundle.zip"
chmod 644 "$WEB_DIR/hermes-node-agent-installer.exe" "$WEB_DIR/hermes-node-agent-bundle.zip"
echo "✅ Published installer and bundle to web directory"
echo "========== BUILD COMPLETE ==========" echo "========== BUILD COMPLETE =========="
echo "Installer created: $DIST_DIR/hermes-node-agent-installer.exe" echo "Installer created: $DIST_DIR/hermes-node-agent-installer.exe"
echo "Size: $(du -h "$DIST_DIR/hermes-node-agent-installer.exe" | cut -f1)" echo "Size: $(du -h "$DIST_DIR/hermes-node-agent-installer.exe" | cut -f1)"
......
; Hermes Node Agent Windows Installer — NSIS ; Hermes Node Agent Windows Installer — NSIS
; Uses PyInstaller --onefile executables ; User-owned config: $APPDATA\HermesNode\config.json
; No admin rights required — installs for current user only
; No Windows service — agent runs as background process
!include "MUI2.nsh" !include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
; ── General ──────────────────────────────────────────────────────────────── ; ── General ────────────────────────────────────────────────────────────────
Name "Hermes Node Agent" Name "Hermes Node Agent"
OutFile "hermes-node-agent-installer.exe" OutFile "hermes-node-agent-installer.exe"
InstallDir "$PROGRAMFILES64\HermesNode" InstallDir "$LOCALAPPDATA\HermesNode"
RequestExecutionLevel admin RequestExecutionLevel user
ShowInstDetails hide ShowInstDetails hide
ShowUninstDetails hide ShowUninstDetails hide
; ── Variables ──────────────────────────────────────────────────────────────
Var Dialog
Var GatewayURLField
Var NodeNameField
Var TokenField
Var GatewayURL
Var NodeName
Var Token
Var StartMenuCheck
Var DesktopCheck
; ── Custom Config Page ─────────────────────────────────────────────────────
Page custom ConfigPageCreate ConfigPageLeave
Function ConfigPageCreate
!insertmacro MUI_HEADER_TEXT "Node Configuration" \"Enter your gateway connection details\"
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
; Gateway URL
${NSD_CreateLabel} 0 0 100% 12u \"Gateway URL:\"
Pop $0
${NSD_CreateText} 0 14u 100% 12u \"wss://your-gateway:8765\"
Pop $GatewayURLField
; Node Name
${NSD_CreateLabel} 0 32u 100% 12u \"Node Name:\"
Pop $0
${NSD_CreateText} 0 46u 100% 12u \"$COMPUTERNAME\"
Pop $NodeNameField
; Token
${NSD_CreateLabel} 0 64u 100% 12u \"Gateway Token:\"
Pop $0
${NSD_CreateText} 0 78u 100% 12u \"\"
Pop $TokenField
nsDialogs::Show
FunctionEnd
Function ConfigPageLeave
${NSD_GetText} $GatewayURLField $GatewayURL
${NSD_GetText} $NodeNameField $NodeName
${NSD_GetText} $TokenField $Token
FunctionEnd
; ── UI ───────────────────────────────────────────────────────────────────── ; ── UI ─────────────────────────────────────────────────────────────────────
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY Page custom ConfigPageCreate ConfigPageLeave
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_LANGUAGE \"English\"
!insertmacro MUI_LANGUAGE "English"
; ── Sections ─────────────────────────────────────────────────────────────── ; ── Sections ───────────────────────────────────────────────────────────────
Section "Install" Section \"Install\"
SetOutPath "$INSTDIR" SetOutPath \"$INSTDIR\"
; PyInstaller-built executables (single-file bundles) ; Executables
File "windows\dist\hermes-node-agent.exe" File \"windows\\dist\\hermes-node-agent.exe\"
File "windows\dist\hermes-node-manager.exe" File \"windows\\dist\\hermes-node-manager.exe\"
; NSSM service wrapper ; Batch script to run agent as background process (user-owned)
File "windows\nssm.exe" File \"windows\\run-agent.bat\"
; Documentation ; Documentation & template
File "WINDOWS_INSTALL.md" File \"WINDOWS_INSTALL.md\"
File \"windows\\config-template.json\"
; Create uninstaller ; Create uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller \"$INSTDIR\\uninstall.exe\"
; Start menu shortcuts ; Config directory (user-owned)
CreateDirectory "$SMPROGRAMS\Hermes Node" CreateDirectory \"$APPDATA\\HermesNode\"
CreateShortCut "$SMPROGRAMS\Hermes Node\Agent (Console).lnk" "$INSTDIR\hermes-node-agent.exe"
CreateShortCut "$SMPROGRAMS\Hermes Node\Manager.lnk" "$INSTDIR\hermes-node-manager.exe"
CreateShortCut "$SMPROGRAMS\Hermes Node\Uninstall.lnk" "$INSTDIR\uninstall.exe"
; Desktop shortcut (optional) ; Write config from collected values
CreateShortCut "$DESKTOP\Hermes Node Agent.lnk" "$INSTDIR\hermes-node-manager.exe" FileOpen $0 \"$APPDATA\\HermesNode\\config.json\" w
FWrite $0 \"{\"
FWrite $0 \" \"gateway_url\": \"\"$GatewayURL\"\",\"
FWrite $0 \" \"node_name\": \"\"$NodeName\"\",\"
FWrite $0 \" \"token\": \"\"$Token\"\",\"
FWrite $0 \" \"sexec_path\": \"./sexec-template.ps1\",\"
FWrite $0 \" \"reconnect_interval\": 5,\"
FWrite $0 \" \"heartbeat_interval\": 30,\"
FWrite $0 \" \"capabilities\": [\"exec\", \"browser_control\", \"computer_control\"]\"
FWrite $0 \"}\"
FileClose $0
; Create config directory ; Start menu shortcuts (user only)
CreateDirectory "$COMMONAPPDATA\hermes-node" CreateDirectory \"$SMPROGRAMS\\Hermes Node\"
CreateShortCut \"$SMPROGRAMS\\Hermes Node\\Agent (Console).lnk\" \"$INSTDIR\\hermes-node-agent.exe\"
CreateShortCut \"$SMPROGRAMS\\Hermes Node\\Manager.lnk\" \"$INSTDIR\\hermes-node-manager.exe\"
CreateShortCut \"$SMPROGRAMS\\Hermes Node\\Uninstall.lnk\" \"$INSTDIR\\uninstall.exe\"
; Register as Windows service using NSSM ; Desktop shortcut (optional)
nsExec::RunToLog '"$INSTDIR\nssm.exe" install HermesNodeAgent "$INSTDIR\hermes-node-agent.exe" --config "$COMMONAPPDATA\hermes-node\config.json"' CreateShortCut \"$DESKTOP\\HermesNodeAgent.lnk\" \"$INSTDIR\\hermes-node-manager.exe\"
nsExec::RunToLog '"$INSTDIR\nssm.exe" set HermesNodeAgent AppDirectory "$INSTDIR"'
nsExec::RunToLog '"$INSTDIR\nssm.exe" set HermesNodeAgent Start SERVICE_AUTO_START' ; Auto-start: Registry Run key (starts at user login)
nsExec::RunToLog '"$INSTDIR\nssm.exe" set HermesNodeAgent AppRestartDelay 5000' WriteRegStr HKCU \"Software\\Microsoft\\Windows\\CurrentVersion\\Run\" \"HermesNodeAgent\" \"\"$INSTDIR\\hermes-node-agent.exe\" --config \"$APPDATA\\HermesNode\\config.json\"\"
; Copy config template if not exists ; Launch manager after install
IfFileExists "$COMMONAPPDATA\hermes-node\config.json" +2 Exec \"$INSTDIR\\hermes-node-manager.exe\"
File /oname="$COMMONAPPDATA\hermes-node\config.json" "windows\config-template.json"
SectionEnd SectionEnd
Section "Uninstall" Section \"Uninstall\"
; Stop and remove service ; Remove auto-start
nsExec::RunToLog '"$INSTDIR\nssm.exe" stop HermesNodeAgent' DeleteRegValue HKCU \"Software\\Microsoft\\Windows\\CurrentVersion\\Run\" \"HermesNodeAgent\"
nsExec::RunToLog '"$INSTDIR\nssm.exe" remove HermesNodeAgent confirm'
; Kill running process
KillProcess \"hermes-node-agent.exe\" \"HERMES-KILL\"
; Remove files ; Remove files
RMDir /r "$INSTDIR" RMDir /r \"$INSTDIR\"
RMDir /r "$SMPROGRAMS\Hermes Node" RMDir /r \"$SMPROGRAMS\\Hermes Node\"
Delete "$DESKTOP\Hermes Node Agent.lnk" Delete \"$DESKTOP\\HermesNodeAgent.lnk\"
; Remove config (optional - keep logs?) ; Remove config (optional — prompt user? for now remove)
; RMDir /r "$COMMONAPPDATA\hermes-node" ; RMDir /r \"$APPDATA\\HermesNode\"
SectionEnd SectionEnd
@echo off
REM Hermes Node Agent launcher (user-owned)
REM Reads config from %APPDATA%\HermesNode\config.json
setlocal
set "AGENT_EXE=%~dp0hermes-node-agent.exe"
set "CONFIG_FILE=%APPDATA%\HermesNode\config.json"
if not exist "%CONFIG_FILE%" (
echo [ERROR] Config file not found: %CONFIG_FILE%
echo Please run the installer first to create your configuration.
pause
exit /b 1
)
if not exist "%AGENT_EXE%" (
echo [ERROR] Agent executable not found: %AGENT_EXE%
pause
exit /b 1
)
echo [INFO] Starting Hermes Node Agent...
echo [INFO] Config: %CONFIG_FILE%
echo [INFO] Press Ctrl+C to stop.
"%AGENT_EXE%" --config "%CONFIG_FILE%"
endlocal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment