farmcontrol-server/packaging/windows/farmcontrol-server.nsi
Tom Butcher 6f3c312f6d
Some checks failed
farmcontrol/farmcontrol-server/pipeline/head There was a failure building this commit
Implement NSIS installer for Farm Control Server and update build scripts
- Added a new NSIS installer script (farmcontrol-server.nsi) for packaging the Farm Control Server on Windows, replacing the previous MSI approach.
- Updated the build process to utilize the new NSIS script, including changes in the finalize-desktop-artifacts.mjs to reflect the new installer format.
- Removed the obsolete MSI build script (build-windows-msi.ps1) and related files to streamline the packaging process.
- Updated the README to reflect changes in the post-package process for Windows installers.
2026-08-01 21:30:11 +01:00

89 lines
2.7 KiB
NSIS

!include "MUI2.nsh"
!include "installer.nsh"
!ifndef OUTFILE
!define OUTFILE "farmcontrol-server-installer.exe"
!endif
!ifndef VERSION
!define VERSION "1.0.0"
!endif
!ifndef SETUP_EXE_NAME
!define SETUP_EXE_NAME "Farm Control Server-Setup.exe"
!endif
!ifndef SETUP_ARCHIVE_NAME
!define SETUP_ARCHIVE_NAME "Farm Control Server-Setup.tar.zst"
!endif
!ifndef SETUP_METADATA_NAME
!define SETUP_METADATA_NAME "Farm Control Server-Setup.metadata.json"
!endif
Name "Farm Control Server"
OutFile "${OUTFILE}"
InstallDir "$PROGRAMFILES64\Farm Control Server"
InstallDirRegKey HKLM "Software\Tom Butcher\Farm Control Server" "InstallDir"
RequestExecutionLevel admin
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Farm Control Server" SecMain
SetOutPath $INSTDIR
File "${SETUP_EXE_NAME}"
File "${SETUP_ARCHIVE_NAME}"
File "${SETUP_METADATA_NAME}"
DetailPrint "Running Farm Control Server setup..."
ExecWait '"$INSTDIR\${SETUP_EXE_NAME}" /S' $0
StrCmp $0 "0" setup_ok setup_failed
setup_failed:
MessageBox MB_ICONSTOP "Farm Control Server setup failed (exit code $0)."
Abort
setup_ok:
!insertmacro customInstall
WriteRegStr HKLM "Software\Tom Butcher\Farm Control Server" "InstallDir" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"DisplayName" "Farm Control Server"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"Publisher" "Tom Butcher"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server" \
"NoRepair" 1
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
!insertmacro customUnInstall
Delete "$INSTDIR\${SETUP_EXE_NAME}"
Delete "$INSTDIR\${SETUP_ARCHIVE_NAME}"
Delete "$INSTDIR\${SETUP_METADATA_NAME}"
Delete "$INSTDIR\launcher.exe"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
DeleteRegKey HKLM "Software\Tom Butcher\Farm Control Server"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control Server"
SectionEnd