NetDesk 1.5.0 — source release

This commit is contained in:
NetDesk committed 2026-10-18 02:02:46 +00:00
commit 40318aafdd
227 files changed
+80798

No files matched your search

+218
View File
@@ -0,0 +1,218 @@
; ============================================================================
; NetDesk by Akronlogic -- Windows installer (NSIS / Modern UI 2)
;
; Installs NetDesk.exe + the 3 MinGW runtime DLLs into %ProgramFiles%\NetDesk,
; creates Start Menu + Desktop shortcuts, registers an uninstaller (Add/Remove
; Programs), and offers an OPTIONAL per-user autostart (HKCU Run).
;
; Build (normally driven by build-installer.ps1):
; makensis netdesk.nsi
; makensis /DSTAGEDIR=dist\NetDesk-Portable /DOUTFILE=dist\NetDesk-Setup-win64.exe netdesk.nsi
; ============================================================================
Unicode true
;----------------------------------------------------------------------------
; Product metadata
;----------------------------------------------------------------------------
!define PRODUCT "NetDesk"
!define COMPANY "Akronlogic"
!define VERSION "0.1.0"
!define URL "https://akronlogic.com"
!define EXE "NetDesk.exe"
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
!define AUTORUN_KEY "Software\Microsoft\Windows\CurrentVersion\Run"
; Staging folder that holds the files to install (produced by build-portable.ps1).
; Overridable from the command line with /DSTAGEDIR=...
!ifndef STAGEDIR
!define STAGEDIR "dist\NetDesk-Portable"
!endif
!ifndef OUTFILE
!define OUTFILE "dist\NetDesk-Setup-win64.exe"
!endif
;----------------------------------------------------------------------------
; General
;----------------------------------------------------------------------------
Name "${PRODUCT} by ${COMPANY}"
OutFile "${OUTFILE}"
InstallDir "$PROGRAMFILES64\${PRODUCT}"
InstallDirRegKey HKLM "Software\${PRODUCT}" "InstallDir"
RequestExecutionLevel admin
SetCompressor /SOLID lzma
BrandingText "${PRODUCT} by ${COMPANY} -- ${URL}"
; Version info stamped on the setup .exe
VIProductVersion "${VERSION}.0"
VIAddVersionKey "ProductName" "${PRODUCT}"
VIAddVersionKey "CompanyName" "${COMPANY}"
VIAddVersionKey "FileDescription" "${PRODUCT} Setup"
VIAddVersionKey "FileVersion" "${VERSION}.0"
VIAddVersionKey "ProductVersion" "${VERSION}.0"
VIAddVersionKey "LegalCopyright" "(c) ${COMPANY}. All rights reserved."
;----------------------------------------------------------------------------
; Modern UI 2
;----------------------------------------------------------------------------
!include "MUI2.nsh"
!include "FileFunc.nsh"
!insertmacro GetSize
!define MUI_ABORTWARNING
; Branded NetDesk icon for the setup .exe and the uninstaller (so Windows Search,
; Explorer and the installer window all show the green NetDesk mark -- not the
; generic NSIS rainbow). Overridable; build-installer.ps1 passes an absolute path
; to packaging\netdesk.ico (copied from assets\icon.ico at build time).
!ifndef BRANDICON
!define BRANDICON "netdesk.ico"
!endif
!define MUI_ICON "${BRANDICON}"
!define MUI_UNICON "${BRANDICON}"
; Offer to launch NetDesk at the end of setup
!define MUI_FINISHPAGE_RUN "$INSTDIR\${EXE}"
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCT} now"
; Install pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Uninstall pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
;----------------------------------------------------------------------------
; Clean (re)install: a running NetDesk locks its own files, so close it first.
; Reinstalling then overwrites the existing install in place (same directory),
; upgrading an older build to this one. Full removal is via the uninstaller.
;----------------------------------------------------------------------------
Function .onInit
ExecWait 'taskkill /F /IM ${EXE} /T'
FunctionEnd
;----------------------------------------------------------------------------
; Sections
;----------------------------------------------------------------------------
Section "!${PRODUCT} (required)" SEC_CORE
SectionIn RO
SetOverwrite on
SetOutPath "$INSTDIR"
; --- Clean (re)install: stop a running host so its binaries unlock ----------
; NetDeskHost.exe is kept alive two ways: a per-user engine/GUI child, AND the
; privileged boot-time Scheduled Task "NetDesk" (the host's SERVICE_TASK,
; created by `NetDeskHost.exe --install`, running as SYSTEM) whose broker
; respawns a session-agent ~every 2s. This installer is elevated
; (RequestExecutionLevel admin), so END THE TASK FIRST (stops the respawner),
; then force-kill every NetDeskHost.exe tree and the GUI. Errors are ignored
; (nothing running on a fresh install is normal). We only /End the task here
; (transient) -- never /Disable -- and /Run it again at the end of this
; section, so unattended autostart is preserved.
nsExec::Exec 'schtasks /End /TN "NetDesk"'
Pop $0
nsExec::Exec 'taskkill /F /IM NetDeskHost.exe /T'
Pop $0
nsExec::Exec 'taskkill /F /IM ${EXE} /T'
Pop $0
; Program + the 3 MinGW runtime DLLs that must sit beside it
File "${STAGEDIR}\${EXE}"
File "${STAGEDIR}\libstdc++-6.dll"
File "${STAGEDIR}\libgcc_s_seh-1.dll"
File "${STAGEDIR}\libwinpthread-1.dll"
File "${STAGEDIR}\README.txt"
; NetDesk is one pure-Rust binary now: the native host engine runs in-process,
; so there is no separate NetDeskHost.exe to install.
; Remember where we installed
WriteRegStr HKLM "Software\${PRODUCT}" "InstallDir" "$INSTDIR"
WriteRegStr HKLM "Software\${PRODUCT}" "Version" "${VERSION}"
; Start Menu shortcut
CreateDirectory "$SMPROGRAMS\${PRODUCT}"
CreateShortCut "$SMPROGRAMS\${PRODUCT}\${PRODUCT}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" 0
CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall ${PRODUCT}.lnk" "$INSTDIR\uninstall.exe"
; Uninstaller + Add/Remove Programs registration
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${PRODUCT} by ${COMPANY}"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${COMPANY}"
WriteRegStr HKLM "${UNINST_KEY}" "URLInfoAbout" "${URL}"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${EXE}"
WriteRegStr HKLM "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
; Estimated size for Add/Remove Programs
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
; --- Bring the host engine back online ------------------------------------
; A fresh host `--install` finishes with `schtasks /Run /TN NetDesk`, so do the
; same: relaunch the now-updated boot-time broker. No-op if there is no task
; yet (first-time install, before the user enables unattended access); the GUI
; itself is relaunched by the Finish page's optional "Launch NetDesk now".
nsExec::Exec 'schtasks /Run /TN "NetDesk"'
Pop $0
SectionEnd
Section "Desktop shortcut" SEC_DESKTOP
CreateShortCut "$DESKTOP\${PRODUCT}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" 0
SectionEnd
Section /o "Start ${PRODUCT} when I sign in" SEC_AUTOSTART
; Per-user autostart (HKCU). Optional, OFF by default. Starts the native host
; engine headlessly on login so the PC is reachable unattended.
WriteRegStr HKCU "${AUTORUN_KEY}" "${PRODUCT}" '"$INSTDIR\${EXE}" --host'
SectionEnd
;----------------------------------------------------------------------------
; Component descriptions
;----------------------------------------------------------------------------
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} "The ${PRODUCT} application and its required runtime files."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Place a ${PRODUCT} shortcut on your Desktop."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_AUTOSTART} "Launch ${PRODUCT} automatically every time you sign in (current user only)."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;----------------------------------------------------------------------------
; Uninstaller
;----------------------------------------------------------------------------
Section "Uninstall"
; Stop the host completely: end the SYSTEM task (stops the broker's respawner),
; kill the engine and the GUI, then REMOVE the autostart task entirely so no
; orphaned boot-time task is left pointing at a deleted exe.
nsExec::Exec 'schtasks /End /TN "NetDesk"'
Pop $0
ExecWait 'taskkill /F /IM NetDeskHost.exe /T'
ExecWait 'taskkill /F /IM ${EXE} /T'
nsExec::Exec 'schtasks /Delete /TN "NetDesk" /F'
Pop $0
Delete "$INSTDIR\${EXE}"
Delete "$INSTDIR\NetDeskHost.exe"
Delete "$INSTDIR\libstdc++-6.dll"
Delete "$INSTDIR\libgcc_s_seh-1.dll"
Delete "$INSTDIR\libwinpthread-1.dll"
Delete "$INSTDIR\README.txt"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\${PRODUCT}\${PRODUCT}.lnk"
Delete "$SMPROGRAMS\${PRODUCT}\Uninstall ${PRODUCT}.lnk"
RMDir "$SMPROGRAMS\${PRODUCT}"
Delete "$DESKTOP\${PRODUCT}.lnk"
DeleteRegValue HKCU "${AUTORUN_KEY}" "${PRODUCT}"
DeleteRegKey HKLM "${UNINST_KEY}"
DeleteRegKey HKLM "Software\${PRODUCT}"
SectionEnd