farmcontrol-server/packaging/windows/farmcontrol-server.nsi
Tom Butcher 29444e2ed4
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
Add rcedit dependency and implement Windows launcher icon embedding
- Added rcedit dependency in package.json and bun.lock for embedding icons in Windows executables.
- Introduced a new script to generate and apply the application icon for Windows launcher binaries, improving visual consistency.
- Updated the NSIS installer script to support dynamic icon paths, enhancing flexibility in icon management during installation.
- Integrated the icon application process into the finalization of desktop artifacts, ensuring the icon is embedded in the generated binaries.
2026-08-01 23:16:22 +01:00

95 lines
2.8 KiB
NSIS

!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "installer.nsh"
!ifndef OUTFILE
!define OUTFILE "farmcontrol-server-installer.exe"
!endif
!ifndef VERSION
!define VERSION "1.0.0"
!endif
!ifndef APP_SOURCE_DIR
!define APP_SOURCE_DIR "."
!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
!ifndef INSTALLER_ICON
!define INSTALLER_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!endif
!define MUI_ICON "${INSTALLER_ICON}"
!define MUI_UNICON "${INSTALLER_ICON}"
Icon "${INSTALLER_ICON}"
UninstallIcon "${INSTALLER_ICON}"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function .onInit
${If} ${Silent}
SetAutoClose true
${EndIf}
FunctionEnd
Section "Farm Control Server" SecMain
SectionIn RO
SetOutPath $INSTDIR
File /r "${APP_SOURCE_DIR}\*"
!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 "Desktop shortcut" SecDesktop
!insertmacro createDesktopShortcut
SectionEnd
Section "Start Menu shortcut" SecStartMenu
!insertmacro createStartMenuShortcut
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} "Install Farm Control Server."
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "Create a shortcut on the Desktop."
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Create a shortcut in the Start Menu."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
!insertmacro customUnInstall
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