Files
ElyOffice/packaging/windows/installer.nsi
T
ZacharyZhang-NYandClaude Opus 5.5 c4495beb39 Windows installer and Linux AppImage carry their engines; a runner probe
Both build on packaging/stage.sh. The NSIS installer takes the staged
folder and removes only what it laid out; installer.sh drives it. The
AppImage gives linuxdeploy the app, the workers and libcef.so.
ElyPDF's test window installs the app's menus first, as ElyTree's
does. probe.yml reports what each Gitea runner holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:16:13 -04:00

89 lines
3.0 KiB
NSIS

; Per-user installer; pass APP_NAME, APP_SLUG, VERSION, STAGE, ICON, TYPES.
Unicode true
!include "MUI2.nsh"
!ifndef APP_NAME
!error "pass -DAPP_NAME"
!endif
!ifndef APP_SLUG
!error "pass -DAPP_SLUG"
!endif
!ifndef VERSION
!error "pass -DVERSION"
!endif
!ifndef STAGE
!error "pass -DSTAGE, a folder from packaging/stage.sh"
!endif
!ifndef ICON
!error "pass -DICON"
!endif
!ifndef TYPES
!error "pass -DTYPES, from packaging/windows/types.sh"
!endif
!include "${TYPES}"
!ifndef OUTFILE
!define OUTFILE "${APP_SLUG}-${VERSION}-setup.exe"
!endif
!define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ely Office ${APP_NAME}"
!define MUI_ICON "${ICON}"
!define MUI_UNICON "${ICON}"
Name "${APP_NAME}"
OutFile "${OUTFILE}"
RequestExecutionLevel user
InstallDir "$LOCALAPPDATA\Programs\Ely Office\${APP_NAME}"
InstallDirRegKey HKCU "Software\Ely Office\${APP_NAME}" "InstallDir"
SetCompressor /SOLID lzma
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "English"
LangString DeleteData ${LANG_SIMPCHINESE} "同时删除 ${APP_NAME} 的缓存、账号与本地历史吗?你的文档不受影响。"
LangString DeleteData ${LANG_ENGLISH} "Also delete the cache, accounts and local history of ${APP_NAME}? Your documents stay."
Section "Install"
SetOutPath "$INSTDIR"
File /r "${STAGE}\*.*"
File "/oname=${APP_SLUG}.ico" "${ICON}"
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${APP_SLUG}.exe" "" "$INSTDIR\${APP_SLUG}.ico"
WriteRegStr HKCU "Software\Ely Office\${APP_NAME}" "InstallDir" "$INSTDIR"
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayName" "${APP_NAME}"
WriteRegStr HKCU "${UNINSTALL_KEY}" "Publisher" "ZacharyZhang"
WriteRegStr HKCU "${UNINSTALL_KEY}" "URLInfoAbout" "https://zacharyzhang.com"
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\${APP_SLUG}.ico"
WriteRegStr HKCU "${UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKCU "${UNINSTALL_KEY}" "NoModify" 1
!insertmacro ElyTypesInstall
SectionEnd
Section "Uninstall"
; What stage.sh lays out, and nothing else.
RMDir /r "$INSTDIR\libreoffice"
RMDir /r "$INSTDIR\tessdata"
RMDir /r "$INSTDIR\git"
RMDir /r "$INSTDIR\content"
RMDir /r "$INSTDIR\locales"
RMDir /r "$INSTDIR\licenses"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.pak"
Delete "$INSTDIR\*.bin"
Delete "$INSTDIR\*.dat"
Delete "$INSTDIR\*.json"
Delete "$INSTDIR\${APP_SLUG}.ico"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
DeleteRegKey HKCU "Software\Ely Office\${APP_NAME}"
DeleteRegKey HKCU "${UNINSTALL_KEY}"
!insertmacro ElyTypesUninstall
MessageBox MB_YESNO|MB_DEFBUTTON2 "$(DeleteData)" IDNO done
RMDir /r "$LOCALAPPDATA\ElyOffice\${APP_SLUG}"
done:
SectionEnd