Skip to content

Commit 61aa855

Browse files
authored
feat(nsis): added support for uninstall components page (electron-userland#9166)
1 parent f200ddb commit 61aa855

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

.changeset/thin-geckos-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
feat(nsis): added supports for uninstall components page

packages/app-builder-lib/templates/nsis/installer.nsi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ Var oldMenuDirectory
1010
!include "multiUser.nsh"
1111
!include "allowOnlyOneInstallerInstance.nsh"
1212

13+
!ifdef BUILD_UNINSTALLER
14+
!ifmacrodef customUnInstallSection
15+
!define MUI_COMPONENTSPAGE_NODESC
16+
!insertmacro MUI_UNPAGE_COMPONENTS
17+
!endif
18+
!endif
19+
1320
!ifdef INSTALL_MODE_PER_ALL_USERS
1421
!ifdef BUILD_UNINSTALLER
1522
RequestExecutionLevel user

packages/app-builder-lib/templates/nsis/uninstaller.nsh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ Function un.restoreFiles
131131
Exch $R0
132132
FunctionEnd
133133

134-
Section "un.install"
134+
!ifndef UNINSTALL_SECTION_NAME
135+
!define UNINSTALL_SECTION_NAME "Uninstall"
136+
!endif
137+
138+
Section "un.${UNINSTALL_SECTION_NAME}"
139+
SectionIn RO
135140
# for assisted installer we check it here to show progress
136141
!ifndef ONE_CLICK
137142
${IfNot} ${Silent}
@@ -243,3 +248,7 @@ Section "un.install"
243248
!insertmacro quitSuccess
244249
!endif
245250
SectionEnd
251+
252+
!ifmacrodef customUnInstallSection
253+
!insertmacro customUnInstallSection
254+
!endif

pages/nsis.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Two options are available — [include](#NsisOptions-include) and [script](#Nsis
2929
Keep in mind — if you customize NSIS script, you should always state about it in the issue reports. And don't expect that your issue will be resolved.
3030

3131
1. Add file `build/installer.nsh`.
32-
2. Define wanted macro to customise: `customHeader`, `preInit`, `customInit`, `customUnInit`, `customInstall`, `customUnInstall`, `customRemoveFiles`, `customInstallMode`, `customWelcomePage`, `customUnWelcomePage`.
32+
2. Define wanted macro to customise: `customHeader`, `preInit`, `customInit`, `customUnInit`, `customInstall`, `customUnInstall`, `customRemoveFiles`, `customInstallMode`, `customWelcomePage`, `customUnWelcomePage`, `customUnInstallSection`.
3333

3434
!!! example
3535
```nsis
@@ -65,6 +65,13 @@ Keep in mind — if you customize NSIS script, you should always state about it
6565
!define MUI_WELCOMEPAGE_TEXT "custom text for uninstaller welcome page $\r$\n more"
6666
!insertmacro MUI_UNPAGE_WELCOME
6767
!macroend
68+
69+
!macro customUnInstallSection
70+
Section /o "un.Some cool checkbox"
71+
; You can add some uninstall section as component page
72+
; If defined, then always run after `customUnInstall`
73+
SectionEnd
74+
!macroend
6875
```
6976

7077
* `BUILD_RESOURCES_DIR` and `PROJECT_DIR` are defined.

0 commit comments

Comments
 (0)