- 新增磁盘加密、打印审计和剪贴板管控插件支持 - 优化水印插件显示效果,支持中文及更多Unicode字符 - 改进硬件资产收集逻辑,更准确获取磁盘和显卡信息 - 增强API错误处理,添加详细日志记录 - 完善前端界面,新增插件管理页面 - 修复多个UI问题,优化页面过渡效果 - 添加环境变量覆盖配置功能 - 实现插件状态管理API - 更新文档和变更日志 - 添加安装程序脚本支持
112 lines
3.2 KiB
NSIS
112 lines
3.2 KiB
NSIS
; CSM Client Installer (NSIS)
|
|
; ---------------------------
|
|
; Build: makensis /DVERSION=0.2.0 installer\client.nsi
|
|
; Silent install: csm-client-0.2.0-setup.exe /S /SERVER=192.168.1.10:9999
|
|
|
|
!define PRODUCT_NAME "CSM Client"
|
|
!define PRODUCT_PUBLISHER "CSM"
|
|
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
|
!define PRODUCT_SERVICE_NAME "CSMClient"
|
|
|
|
; Use LZMA compression for smaller installer
|
|
SetCompressor lzma
|
|
|
|
Name "${PRODUCT_NAME} ${VERSION}"
|
|
OutFile "release\v${VERSION}\csm-client-${VERSION}-setup.exe"
|
|
InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
|
|
RequestExecutionLevel admin
|
|
|
|
; --- Pages ---
|
|
Page directory
|
|
Page custom ServerPage ServerPageLeave
|
|
Page instfiles
|
|
UninstPage uninstConfirm
|
|
UninstPage instfiles
|
|
|
|
; --- Variables ---
|
|
Var ServerAddress
|
|
|
|
; --- Custom page for server address input ---
|
|
Function ServerPage
|
|
!insertmacro MUI_HEADER_TEXT "Server Configuration" "Enter the CSM server address"
|
|
nsDialogs::Create 1018
|
|
Pop $0
|
|
|
|
${NSD_CreateLabel} 0 0 100% 12u "CSM Server Address (host:port):"
|
|
Pop $0
|
|
|
|
${NSD_CreateText} 0 14u 100% 12u "127.0.0.1:9999"
|
|
Pop $1
|
|
|
|
nsDialogs::Show
|
|
FunctionEnd
|
|
|
|
Function ServerPageLeave
|
|
${NSD_GetText} $1 $ServerAddress
|
|
${If} $ServerAddress == ""
|
|
MessageBox MB_ICONEXCLAMATION "Please enter a server address"
|
|
Abort
|
|
${EndIf}
|
|
FunctionEnd
|
|
|
|
; --- Install Section ---
|
|
Section "Install"
|
|
SetOutPath $INSTDIR
|
|
|
|
; Stop service if running
|
|
nsExec::ExecToLog 'net stop ${PRODUCT_SERVICE_NAME}'
|
|
Sleep 2000
|
|
|
|
; Copy binary
|
|
File "release\v${VERSION}\csm-client-${VERSION}.exe"
|
|
|
|
; Write config file
|
|
FileOpen $0 "$INSTDIR\client.env" w
|
|
FileWrite $0 "CSM_SERVER=$ServerAddress$\r$\n"
|
|
FileClose $0
|
|
|
|
; Register as Windows service
|
|
nsExec::ExecToLog '"$INSTDIR\csm-client-${VERSION}.exe" --install'
|
|
Sleep 1000
|
|
|
|
; Start service
|
|
nsExec::ExecToLog 'net start ${PRODUCT_SERVICE_NAME}'
|
|
|
|
; Write uninstaller
|
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
|
|
; Registry entries
|
|
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
|
|
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
|
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
|
WriteRegDWORD HKLM "${PRODUCT_UNINST_KEY}" "EstimatedSize" 5120
|
|
|
|
; Create Start Menu shortcut
|
|
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
|
|
CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
|
SectionEnd
|
|
|
|
; --- Uninstall Section ---
|
|
Section "Uninstall"
|
|
; Stop and remove service
|
|
nsExec::ExecToLog 'net stop ${PRODUCT_SERVICE_NAME}'
|
|
Sleep 2000
|
|
nsExec::ExecToLog '"$INSTDIR\csm-client-${VERSION}.exe" --uninstall'
|
|
Sleep 1000
|
|
|
|
; Remove files
|
|
Delete "$INSTDIR\csm-client-*.exe"
|
|
Delete "$INSTDIR\client.env"
|
|
Delete "$INSTDIR\csm_client_service.log"
|
|
Delete "$INSTDIR\uninstall.exe"
|
|
RMDir "$INSTDIR"
|
|
|
|
; Remove shortcuts
|
|
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
|
|
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
|
|
|
|
; Remove registry
|
|
DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}"
|
|
SectionEnd
|