cross-packer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +151 -0
  3. package/README.zh-CN.md +151 -0
  4. package/dist/archive/ar.d.ts +12 -0
  5. package/dist/archive/seven-za.d.ts +32 -0
  6. package/dist/archive/tar.d.ts +30 -0
  7. package/dist/archive/zip-reader.d.ts +17 -0
  8. package/dist/asar/dependency/collect.d.ts +2 -0
  9. package/dist/asar/dependency/detector.d.ts +8 -0
  10. package/dist/asar/dependency/hoister.d.ts +27 -0
  11. package/dist/asar/dependency/utils.d.ts +59 -0
  12. package/dist/asar/fileset/matcher.d.ts +12 -0
  13. package/dist/asar/fileset/platform-fileset.d.ts +36 -0
  14. package/dist/asar/fileset/transformer.d.ts +2 -0
  15. package/dist/asar/fileset/unpack-detector.d.ts +10 -0
  16. package/dist/asar/fileset/walker.d.ts +14 -0
  17. package/dist/asar/pack.d.ts +23 -0
  18. package/dist/asar/packer/app-collector.d.ts +2 -0
  19. package/dist/asar/packer/collector.d.ts +18 -0
  20. package/dist/asar/packer/concurrency.d.ts +1 -0
  21. package/dist/asar/packer/integrity.d.ts +8 -0
  22. package/dist/asar/packer/nm-collector.d.ts +7 -0
  23. package/dist/asar/packer/stream-builder.d.ts +18 -0
  24. package/dist/cli.d.ts +2 -0
  25. package/dist/config/index.d.ts +97 -0
  26. package/dist/electron/dist-zip.d.ts +18 -0
  27. package/dist/electron/download.d.ts +21 -0
  28. package/dist/index.d.ts +11 -0
  29. package/dist/packer/common/app-update-yml.d.ts +5 -0
  30. package/dist/packer/common/extra-resources.d.ts +39 -0
  31. package/dist/packer/common/staging.d.ts +3 -0
  32. package/dist/packer/common/template.d.ts +2 -0
  33. package/dist/packer/linux/linux.d.ts +2 -0
  34. package/dist/packer/mac/mac.d.ts +23 -0
  35. package/dist/packer/win/nsis.d.ts +24 -0
  36. package/dist/packer/win/resedit.d.ts +5 -0
  37. package/dist/packer/win/toolchain.d.ts +8 -0
  38. package/dist/packer/win/win.d.ts +12 -0
  39. package/dist/pipeline/pipeline.d.ts +41 -0
  40. package/dist/pipeline/targets.d.ts +28 -0
  41. package/dist/shared/hash.d.ts +2 -0
  42. package/dist/shared/logger.d.ts +39 -0
  43. package/dist/shared/platform.d.ts +26 -0
  44. package/dist/shared/types.d.ts +68 -0
  45. package/dist/update/blockmap.d.ts +13 -0
  46. package/dist/update/metadata.d.ts +20 -0
  47. package/dist/update/version.d.ts +7 -0
  48. package/package.json +71 -0
  49. package/src/archive/ar.ts +41 -0
  50. package/src/archive/seven-za.ts +160 -0
  51. package/src/archive/tar.ts +142 -0
  52. package/src/archive/zip-reader.ts +61 -0
  53. package/src/asar/dependency/collect.ts +437 -0
  54. package/src/asar/dependency/detector.ts +73 -0
  55. package/src/asar/dependency/hoister.ts +714 -0
  56. package/src/asar/dependency/utils.ts +225 -0
  57. package/src/asar/fileset/matcher.ts +101 -0
  58. package/src/asar/fileset/platform-fileset.ts +416 -0
  59. package/src/asar/fileset/transformer.ts +154 -0
  60. package/src/asar/fileset/unpack-detector.ts +38 -0
  61. package/src/asar/fileset/walker.ts +115 -0
  62. package/src/asar/pack.ts +186 -0
  63. package/src/asar/packer/app-collector.ts +74 -0
  64. package/src/asar/packer/collector.ts +134 -0
  65. package/src/asar/packer/concurrency.ts +24 -0
  66. package/src/asar/packer/integrity.ts +53 -0
  67. package/src/asar/packer/nm-collector.ts +194 -0
  68. package/src/asar/packer/stream-builder.ts +723 -0
  69. package/src/cli.ts +182 -0
  70. package/src/config/index.ts +365 -0
  71. package/src/electron/dist-zip.ts +65 -0
  72. package/src/electron/download.ts +121 -0
  73. package/src/index.ts +14 -0
  74. package/src/packer/common/app-update-yml.ts +21 -0
  75. package/src/packer/common/extra-resources.ts +83 -0
  76. package/src/packer/common/staging.ts +33 -0
  77. package/src/packer/common/template.ts +24 -0
  78. package/src/packer/linux/linux.ts +329 -0
  79. package/src/packer/mac/mac.ts +495 -0
  80. package/src/packer/win/nsis.ts +244 -0
  81. package/src/packer/win/resedit.ts +60 -0
  82. package/src/packer/win/toolchain.ts +63 -0
  83. package/src/packer/win/win.ts +421 -0
  84. package/src/pipeline/pipeline.ts +149 -0
  85. package/src/pipeline/targets.ts +67 -0
  86. package/src/shared/hash.ts +15 -0
  87. package/src/shared/logger.ts +91 -0
  88. package/src/shared/platform.ts +41 -0
  89. package/src/shared/types.ts +82 -0
  90. package/src/update/blockmap.ts +247 -0
  91. package/src/update/metadata.ts +97 -0
  92. package/src/update/version.ts +59 -0
  93. package/templates/linux/app.desktop +11 -0
  94. package/templates/linux/control +9 -0
  95. package/templates/linux/postinst +10 -0
  96. package/templates/linux/postrm +8 -0
  97. package/templates/linux/preinst +49 -0
  98. package/templates/linux/prerm +43 -0
  99. package/templates/mac/Info.plist +18 -0
  100. package/templates/mac/app-update.yml +4 -0
  101. package/templates/win/nsis/README.md +51 -0
  102. package/templates/win/nsis/THIRD-PARTY-NOTICES.md +20 -0
  103. package/templates/win/nsis/assistedInstaller.nsh +154 -0
  104. package/templates/win/nsis/assistedMessages.yml +368 -0
  105. package/templates/win/nsis/common.nsh +147 -0
  106. package/templates/win/nsis/empty-license.txt +1 -0
  107. package/templates/win/nsis/include/FileAssociation.nsh +123 -0
  108. package/templates/win/nsis/include/StdUtils.nsh +496 -0
  109. package/templates/win/nsis/include/StrContains.nsh +48 -0
  110. package/templates/win/nsis/include/UAC.nsh +299 -0
  111. package/templates/win/nsis/include/allowOnlyOneInstallerInstance.nsh +164 -0
  112. package/templates/win/nsis/include/extractAppPackage.nsh +138 -0
  113. package/templates/win/nsis/include/getProcessInfo.nsh +157 -0
  114. package/templates/win/nsis/include/installUtil.nsh +248 -0
  115. package/templates/win/nsis/include/installer.nsh +247 -0
  116. package/templates/win/nsis/include/nsProcess.nsh +28 -0
  117. package/templates/win/nsis/include/webPackage.nsh +64 -0
  118. package/templates/win/nsis/installSection.nsh +110 -0
  119. package/templates/win/nsis/installer.nsi +132 -0
  120. package/templates/win/nsis/messages.yml +240 -0
  121. package/templates/win/nsis/multiUser.nsh +134 -0
  122. package/templates/win/nsis/multiUserUi.nsh +230 -0
  123. package/templates/win/nsis/oneClick.nsh +19 -0
  124. package/templates/win/nsis/portable.nsi +91 -0
  125. package/templates/win/nsis/uninstaller.nsh +263 -0
  126. package/templates/win/nsis-header.nsh +57 -0
@@ -0,0 +1,134 @@
1
+ !include FileFunc.nsh
2
+ !include UAC.nsh
3
+
4
+ !define FOLDERID_UserProgramFiles {5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}
5
+ !define KF_FLAG_CREATE 0x00008000
6
+
7
+ # allow user to define own custom
8
+ !define /ifndef INSTALL_REGISTRY_KEY "Software\${APP_GUID}"
9
+ !define /ifndef UNINSTALL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
10
+
11
+ # current Install Mode ("all" or "CurrentUser")
12
+ Var installMode
13
+
14
+ !ifndef INSTALL_MODE_PER_ALL_USERS
15
+ !ifndef ONE_CLICK
16
+ Var hasPerUserInstallation
17
+ Var hasPerMachineInstallation
18
+ !endif
19
+ Var PerUserInstallationFolder
20
+
21
+ !macro setInstallModePerUser
22
+ StrCpy $installMode CurrentUser
23
+ SetShellVarContext current
24
+
25
+ # сhecks registry for previous installation path
26
+ ReadRegStr $perUserInstallationFolder HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation
27
+ ${if} $perUserInstallationFolder != ""
28
+ StrCpy $INSTDIR $perUserInstallationFolder
29
+ ${else}
30
+ StrCpy $0 "$LocalAppData\Programs"
31
+ System::Store S
32
+ # Win7 has a per-user programfiles known folder and this can be a non-default location
33
+ System::Call 'SHELL32::SHGetKnownFolderPath(g "${FOLDERID_UserProgramFiles}", i ${KF_FLAG_CREATE}, p 0, *p .r2)i.r1'
34
+ ${If} $1 == 0
35
+ System::Call '*$2(&w${NSIS_MAX_STRLEN} .s)'
36
+ StrCpy $0 $1
37
+ System::Call 'OLE32::CoTaskMemFree(p r2)'
38
+ ${endif}
39
+ System::Store L
40
+ StrCpy $INSTDIR "$0\${APP_FILENAME}"
41
+ ${endif}
42
+
43
+ # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551
44
+ !insertmacro GetDParameter $R0
45
+ ${If} $R0 != ""
46
+ StrCpy $INSTDIR $R0
47
+ ${endif}
48
+
49
+ !macroend
50
+ !endif
51
+
52
+ !ifdef INSTALL_MODE_PER_ALL_USERS_REQUIRED
53
+ Var perMachineInstallationFolder
54
+
55
+ !macro setInstallModePerAllUsers
56
+ StrCpy $installMode all
57
+ SetShellVarContext all
58
+
59
+ !ifdef BUILD_UNINSTALLER
60
+ ${IfNot} ${UAC_IsAdmin}
61
+ ShowWindow $HWNDPARENT ${SW_HIDE}
62
+ !insertmacro UAC_RunElevated
63
+ Quit
64
+ ${endif}
65
+ !endif
66
+
67
+ # сheck registry for previous installation path
68
+ ReadRegStr $perMachineInstallationFolder HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation
69
+ ${if} $perMachineInstallationFolder != ""
70
+ StrCpy $INSTDIR $perMachineInstallationFolder
71
+ ${else}
72
+ StrCpy $0 "$PROGRAMFILES"
73
+ !ifdef APP_64
74
+ ${if} ${RunningX64}
75
+ StrCpy $0 "$PROGRAMFILES64"
76
+ ${endif}
77
+ !endif
78
+
79
+ !ifdef MENU_FILENAME
80
+ StrCpy $0 "$0\${MENU_FILENAME}"
81
+ !endif
82
+
83
+ StrCpy $INSTDIR "$0\${APP_FILENAME}"
84
+ ${endif}
85
+
86
+ # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551
87
+ !insertmacro GetDParameter $R0
88
+ ${If} $R0 != ""
89
+ StrCpy $INSTDIR $R0
90
+ ${endif}
91
+
92
+ !macroend
93
+ !endif
94
+
95
+ # Custom function to handle /D parameter with spaces
96
+ # The /D parameter is special in NSIS - it must be the last parameter and cannot have quotes
97
+ # Use StdUtils.GetParameter to get the full command line, then parse /D= manually
98
+ !macro GetDParameter outVar
99
+ Push $R8
100
+ Push $R9
101
+ Push $R7
102
+ Push $R6
103
+ Push $R5
104
+
105
+ # Get the complete command line using StdUtils (including /D parameter)
106
+ ${StdUtils.GetAllParameters} $R8 "0"
107
+
108
+ # Initialize result
109
+ StrCpy $R9 ""
110
+
111
+ # Search for /D= or /d= using a simple loop
112
+ StrLen $R7 $R8
113
+ IntOp $R7 $R7 - 2 # Don't check last 2 characters
114
+ StrCpy $R6 0
115
+
116
+ ${Do}
117
+ StrCpy $R5 $R8 3 $R6 # Get 3 characters starting at position $R6
118
+ ${If} $R5 == "/D="
119
+ ${OrIf} $R5 == "/d="
120
+ # Found /D= or /d=, extract everything after it
121
+ IntOp $R6 $R6 + 3
122
+ StrCpy $R9 $R8 "" $R6
123
+ ${Break}
124
+ ${EndIf}
125
+ IntOp $R6 $R6 + 1
126
+ ${LoopUntil} $R6 > $R7
127
+
128
+ StrCpy ${outVar} $R9
129
+ Pop $R5
130
+ Pop $R6
131
+ Pop $R7
132
+ Pop $R9
133
+ Pop $R8
134
+ !macroend
@@ -0,0 +1,230 @@
1
+ !include nsDialogs.nsh
2
+
3
+ Var HasTwoAvailableOptions
4
+ Var RadioButtonLabel1
5
+ Var isForceMachineInstall
6
+ Var isForceCurrentInstall
7
+
8
+ !macro PAGE_INSTALL_MODE
9
+ !insertmacro MUI_PAGE_INIT
10
+
11
+ !insertmacro MUI_SET MULTIUSER_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLMODEPAGE ""
12
+ Var MultiUser.InstallModePage
13
+ Var MultiUser.InstallModePage.Text
14
+ Var MultiUser.InstallModePage.AllUsers
15
+ Var MultiUser.InstallModePage.CurrentUser
16
+ Var MultiUser.InstallModePage.ReturnValue
17
+
18
+ !ifndef BUILD_UNINSTALLER
19
+ !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} ""
20
+ PageEx custom
21
+ PageCallbacks MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID}
22
+ Caption " "
23
+ PageExEnd
24
+ !else
25
+ !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} un.
26
+ UninstPage custom un.multiUser.InstallModePre_${MUI_UNIQUEID} un.MultiUser.InstallModeLeave_${MUI_UNIQUEID}
27
+ !endif
28
+ !macroend
29
+
30
+ !macro FUNCTION_INSTALL_MODE_PAGE_FUNCTION PRE LEAVE UNINSTALLER_FUNCPREFIX
31
+ Function "${UNINSTALLER_FUNCPREFIX}${PRE}"
32
+ ${if} ${UAC_IsInnerInstance}
33
+ ${andIf} ${UAC_IsAdmin}
34
+ # inner Process (and Admin) - skip selection, inner process is always used for elevation (machine-wide)
35
+ !insertmacro setInstallModePerAllUsers
36
+ Abort
37
+ ${endIf}
38
+
39
+ StrCpy $isForceMachineInstall "0"
40
+ StrCpy $isForceCurrentInstall "0"
41
+ !ifmacrodef customInstallmode
42
+ !insertmacro customInstallMode
43
+ !endif
44
+
45
+ ${if} $isForceMachineInstall == "1"
46
+ ${OrIf} ${isForAllUsers}
47
+ StrCpy $hasPerMachineInstallation "1"
48
+ StrCpy $hasPerUserInstallation "0"
49
+ ${ifNot} ${UAC_IsAdmin}
50
+ ShowWindow $HWNDPARENT ${SW_HIDE}
51
+ !insertmacro UAC_RunElevated
52
+ Quit
53
+ ${endIf}
54
+
55
+ !insertmacro setInstallModePerAllUsers
56
+ Abort
57
+ ${endIf}
58
+
59
+ ${if} $isForceCurrentInstall == "1"
60
+ ${OrIf} ${isForCurrentUser}
61
+ StrCpy $hasPerMachineInstallation "0"
62
+ StrCpy $hasPerUserInstallation "1"
63
+ !insertmacro setInstallModePerUser
64
+ Abort
65
+ ${endIf}
66
+
67
+ # If uninstalling, will check if there is both a per-user and per-machine installation. If there is only one, will skip the form.
68
+ # If uninstallation was invoked from the "add/remove programs" Windows will automatically requests elevation (depending if uninstall keys are in HKLM or HKCU)
69
+ # so (for uninstallation) just checking UAC_IsAdmin would probably be enought to determine if it's a per-user or per-machine. However, user can run the uninstall.exe from the folder itself
70
+ !ifdef BUILD_UNINSTALLER
71
+ ${if} $hasPerUserInstallation == "1"
72
+ ${andif} $hasPerMachineInstallation == "0"
73
+ !insertmacro setInstallModePerUser
74
+ Abort
75
+ ${elseIf} $hasPerUserInstallation == "0"
76
+ ${andIf} $hasPerMachineInstallation == "1"
77
+ ${IfNot} ${UAC_IsAdmin}
78
+ ShowWindow $HWNDPARENT ${SW_HIDE}
79
+ !insertmacro UAC_RunElevated
80
+ Quit
81
+ ${endIf}
82
+
83
+ !insertmacro setInstallModePerAllUsers
84
+ Abort
85
+ ${endIf}
86
+
87
+ !insertmacro MUI_HEADER_TEXT "$(chooseUninstallationOptions)" "$(whichInstallationShouldBeRemoved)"
88
+ !else
89
+ !insertmacro MUI_HEADER_TEXT "$(chooseInstallationOptions)" "$(whoShouldThisApplicationBeInstalledFor)"
90
+ !endif
91
+
92
+ !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
93
+ nsDialogs::Create 1018
94
+ Pop $MultiUser.InstallModePage
95
+
96
+ !ifndef BUILD_UNINSTALLER
97
+ ${NSD_CreateLabel} 0u 0u 300u 20u "$(selectUserMode)"
98
+ StrCpy $8 "$(forAll)"
99
+ StrCpy $9 "$(onlyForMe)"
100
+ !else
101
+ ${NSD_CreateLabel} 0u 0u 300u 20u "$(whichInstallationRemove)"
102
+ StrCpy $8 "$(forAll)"
103
+ StrCpy $9 "$(onlyForMe)"
104
+ !endif
105
+ Pop $MultiUser.InstallModePage.Text
106
+
107
+ ${NSD_CreateRadioButton} 10u 30u 280u 20u "$8"
108
+ Pop $MultiUser.InstallModePage.AllUsers
109
+ ${IfNot} ${UAC_IsAdmin}
110
+ !ifdef MULTIUSER_INSTALLMODE_ALLOW_ELEVATION
111
+ StrCpy $HasTwoAvailableOptions 1
112
+ !else
113
+ # since radio button is disabled, we add that comment to the disabled control itself
114
+ SendMessage $MultiUser.InstallModePage.AllUsers ${WM_SETTEXT} 0 "STR:$8 (must run as admin)"
115
+ EnableWindow $MultiUser.InstallModePage.AllUsers 0 # start out disabled
116
+ StrCpy $HasTwoAvailableOptions 0
117
+ !endif
118
+ ${else}
119
+ StrCpy $HasTwoAvailableOptions 1
120
+ ${endif}
121
+
122
+ System::Call "advapi32::GetUserName(t.r0,*i${NSIS_MAX_STRLEN})i"
123
+ ${NSD_CreateRadioButton} 10u 50u 280u 20u "$9 ($0)"
124
+ Pop $MultiUser.InstallModePage.CurrentUser
125
+
126
+ nsDialogs::SetUserData $MultiUser.InstallModePage.AllUsers 1 ; Install for All Users (1, pra exibir o icone SHIELD de elevation)
127
+ nsDialogs::SetUserData $MultiUser.InstallModePage.CurrentUser 0 ; Install for Single User (0 pra não exibir)
128
+
129
+ ${if} $HasTwoAvailableOptions == "1" ; if there are 2 available options, bind to radiobutton change
130
+ ${NSD_OnClick} $MultiUser.InstallModePage.CurrentUser ${UNINSTALLER_FUNCPREFIX}InstModeChange
131
+ ${NSD_OnClick} $MultiUser.InstallModePage.AllUsers ${UNINSTALLER_FUNCPREFIX}InstModeChange
132
+ ${endif}
133
+
134
+ ${NSD_CreateLabel} 0u 110u 280u 50u ""
135
+ Pop $RadioButtonLabel1
136
+
137
+ ${if} $installMode == "all"
138
+ SendMessage $MultiUser.InstallModePage.AllUsers ${BM_SETCHECK} ${BST_CHECKED} 0 ; set as default
139
+ SendMessage $MultiUser.InstallModePage.AllUsers ${BM_CLICK} 0 0 ; trigger click event
140
+ ${else}
141
+ SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0 ; set as default
142
+ SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_CLICK} 0 0 ; trigger click event
143
+ ${endif}
144
+
145
+ !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW
146
+ nsDialogs::Show
147
+ FunctionEnd
148
+
149
+ Function "${UNINSTALLER_FUNCPREFIX}${LEAVE}"
150
+ SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue
151
+
152
+ ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED}
153
+ ${IfNot} ${UAC_IsAdmin}
154
+ ShowWindow $HWNDPARENT ${SW_HIDE}
155
+ !insertmacro UAC_RunElevated
156
+ ${Switch} $0
157
+ ${Case} 0
158
+ ${If} $1 = 1
159
+ Quit ;we are the outer process, the inner process has done its work (ExitCode is $2), we are done
160
+ ${EndIf}
161
+ ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
162
+ ${OrIf} $2 = 0x666666 ;our special return, the new process was not admin after all
163
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(loginWithAdminAccount)"
164
+ ${EndIf}
165
+ ${Break}
166
+ ${Case} 1223 ;user aborted
167
+ ;MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This option requires admin privileges, aborting!"
168
+ ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons
169
+ ${Break}
170
+ ${Case} 1062
171
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!" ; "Unable to elevate, Secondary Logon service not running!"
172
+ ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons
173
+ ${Break}
174
+ ${Default}
175
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0"
176
+ ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons
177
+ ${Break}
178
+ ${EndSwitch}
179
+
180
+ ShowWindow $HWNDPARENT ${SW_SHOW}
181
+ BringToFront
182
+ Abort
183
+ ${else}
184
+ !insertmacro setInstallModePerAllUsers
185
+ ${endif}
186
+ ${else}
187
+ !insertmacro setInstallModePerUser
188
+ ${endif}
189
+
190
+ !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE
191
+ FunctionEnd
192
+
193
+ Function "${UNINSTALLER_FUNCPREFIX}InstModeChange"
194
+ pop $1
195
+ nsDialogs::GetUserData $1
196
+ pop $1
197
+ GetDlgItem $0 $hwndParent 1 ; get item 1 (next button) at parent window, store in $0 - (0 is back, 1 is next .. what about CANCEL? http://nsis.sourceforge.net/Buttons_Header )
198
+
199
+ StrCpy $7 ""
200
+ ${if} "$1" == "0" ; current user
201
+ ${if} $hasPerUserInstallation == "1"
202
+ !ifndef BUILD_UNINSTALLER
203
+ StrCpy $7 "$(perUserInstallExists)($perUserInstallationFolder)$\r$\n$(reinstallUpgrade)"
204
+ !else
205
+ StrCpy $7 "$(perUserInstall)($perUserInstallationFolder)$\r$\n$(uninstall)"
206
+ !endif
207
+ ${else}
208
+ StrCpy $7 "$(freshInstallForCurrent)"
209
+ ${endif}
210
+ SendMessage $0 ${BCM_SETSHIELD} 0 0 ; hide SHIELD
211
+ ${else} ; all users
212
+ ${if} $hasPerMachineInstallation == "1"
213
+ !ifndef BUILD_UNINSTALLER
214
+ StrCpy $7 "$(perMachineInstallExists)($perMachineInstallationFolder)$\r$\n$(reinstallUpgrade)"
215
+ !else
216
+ StrCpy $7 "$(perMachineInstall)($perMachineInstallationFolder)$\r$\n$(uninstall)"
217
+ !endif
218
+ ${else}
219
+ StrCpy $7 "$(freshInstallForAll)"
220
+ ${endif}
221
+ ${ifNot} ${UAC_IsAdmin}
222
+ StrCpy $7 "$7"
223
+ SendMessage $0 ${BCM_SETSHIELD} 0 1 ; display SHIELD
224
+ ${else}
225
+ SendMessage $0 ${BCM_SETSHIELD} 0 0 ; hide SHIELD
226
+ ${endif}
227
+ ${endif}
228
+ SendMessage $RadioButtonLabel1 ${WM_SETTEXT} 0 "STR:$7"
229
+ FunctionEnd
230
+ !macroend
@@ -0,0 +1,19 @@
1
+ !ifndef BUILD_UNINSTALLER
2
+ !ifmacrodef licensePage
3
+ !insertmacro skipPageIfUpdated
4
+ !insertmacro licensePage
5
+ !endif
6
+ !endif
7
+
8
+ !insertmacro MUI_PAGE_INSTFILES
9
+ !ifdef BUILD_UNINSTALLER
10
+ !insertmacro MUI_UNPAGE_INSTFILES
11
+ !endif
12
+
13
+ !macro initMultiUser
14
+ !ifdef INSTALL_MODE_PER_ALL_USERS
15
+ !insertmacro setInstallModePerAllUsers
16
+ !else
17
+ !insertmacro setInstallModePerUser
18
+ !endif
19
+ !macroend
@@ -0,0 +1,91 @@
1
+ !include "common.nsh"
2
+ !include "extractAppPackage.nsh"
3
+
4
+ # https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582
5
+ CRCCheck off
6
+ WindowIcon Off
7
+ AutoCloseWindow True
8
+ RequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}
9
+
10
+ Function .onInit
11
+ !ifndef SPLASH_IMAGE
12
+ SetSilent silent
13
+ !endif
14
+
15
+ !insertmacro check64BitAndSetRegView
16
+ FunctionEnd
17
+
18
+ Function .onGUIInit
19
+ InitPluginsDir
20
+
21
+ !ifdef SPLASH_IMAGE
22
+ File /oname=$PLUGINSDIR\splash.bmp "${SPLASH_IMAGE}"
23
+ BgImage::SetBg $PLUGINSDIR\splash.bmp
24
+ BgImage::Redraw
25
+ !endif
26
+ FunctionEnd
27
+
28
+ Section
29
+ !ifdef SPLASH_IMAGE
30
+ HideWindow
31
+ !endif
32
+
33
+ StrCpy $INSTDIR "$PLUGINSDIR\app"
34
+ !ifdef UNPACK_DIR_NAME
35
+ StrCpy $INSTDIR "$TEMP\${UNPACK_DIR_NAME}"
36
+ !endif
37
+
38
+ RMDir /r $INSTDIR
39
+ SetOutPath $INSTDIR
40
+
41
+ !ifdef APP_DIR_64
42
+ !ifdef APP_DIR_ARM64
43
+ !ifdef APP_DIR_32
44
+ ${if} ${IsNativeARM64}
45
+ File /r "${APP_DIR_ARM64}\*.*"
46
+ ${elseif} ${RunningX64}
47
+ File /r "${APP_DIR_64}\*.*"
48
+ ${else}
49
+ File /r "${APP_DIR_32}\*.*"
50
+ ${endIf}
51
+ !else
52
+ ${if} ${IsNativeARM64}
53
+ File /r "${APP_DIR_ARM64}\*.*"
54
+ ${else}
55
+ File /r "${APP_DIR_64}\*.*"
56
+ {endIf}
57
+ !endif
58
+ !else
59
+ !ifdef APP_DIR_32
60
+ ${if} ${RunningX64}
61
+ File /r "${APP_DIR_64}\*.*"
62
+ ${else}
63
+ File /r "${APP_DIR_32}\*.*"
64
+ ${endIf}
65
+ !else
66
+ File /r "${APP_DIR_64}\*.*"
67
+ !endif
68
+ !endif
69
+ !else
70
+ !ifdef APP_DIR_32
71
+ File /r "${APP_DIR_32}\*.*"
72
+ !else
73
+ !insertmacro extractEmbeddedAppPackage
74
+ !endif
75
+ !endif
76
+
77
+ System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_DIR", "$EXEDIR").r0'
78
+ System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_FILE", "$EXEPATH").r0'
79
+ System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_APP_FILENAME", "${APP_FILENAME}").r0'
80
+ ${StdUtils.GetAllParameters} $R0 0
81
+
82
+ !ifdef SPLASH_IMAGE
83
+ BgImage::Destroy
84
+ !endif
85
+
86
+ ExecWait "$INSTDIR\${APP_EXECUTABLE_FILENAME} $R0" $0
87
+ SetErrorLevel $0
88
+
89
+ SetOutPath $EXEDIR
90
+ RMDir /r $INSTDIR
91
+ SectionEnd