-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakesetup.nsi
More file actions
258 lines (220 loc) · 8.36 KB
/
makesetup.nsi
File metadata and controls
258 lines (220 loc) · 8.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
; Script generated by the HM NIS Edit Script Wizard.
SetCompressor lzma
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "ljArchive"
!define PRODUCT_VERSION "0.9.10"
!define PRODUCT_PUBLISHER "sharpden"
!define PRODUCT_WEB_SITE "https://github.com/sharpden/ljarchive"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\ljArchive.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "WindowsForms/res/App.ico"
!define MUI_UNICON "WindowsForms/res/App.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "License.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\ljArchive.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\index.htm"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME}"
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}-setup.exe"
InstallDir "$PROGRAMFILES\ljArchive"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
Call IsDotNETInstalled
Pop $0
StrCmp $0 1 found.NETFramework
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "This installer cannot detect the .NET Framework on your computer. You can download it from Windows Update, or visit the ljArchive web site for a download link. ljArchive will not work without the .NET framework - do you want to install ljArchive anyway?" IDYES +2
Abort
found.NETFramework:
FunctionEnd
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite try
File "bin\Release\CommandBar.dll"
File "bin\Release\CookComputing.XmlRpcLocal.dll"
File "bin\Release\EF.ljArchive.Common.dll"
File "bin\Release\EF.ljArchive.Engine.dll"
SetOutPath "$INSTDIR\fr-FR"
File "bin\Release\fr-FR\ljArchive.resources.dll"
SetOutPath "$INSTDIR"
File "bin\Release\GenghisLocal.dll"
File "bin\Release\ljArchive.exe"
CreateDirectory "$SMPROGRAMS\ljArchive"
CreateShortCut "$SMPROGRAMS\ljArchive\ljArchive.lnk" "$INSTDIR\ljArchive.exe"
SetOverwrite ifnewer
File "index.htm"
CreateShortCut "$SMPROGRAMS\ljArchive\ljArchive Info.lnk" "$INSTDIR\index.htm"
SectionEnd
Section "Plugins" SEC02
SetOutPath "$INSTDIR\plugins"
SetOverwrite try
File "bin\Release\plugins\EF.ljArchive.Plugins.Core.dll"
File "bin\Release\plugins\EF.ljArchive.Plugins.WindowsForms.dll"
File "bin\Release\plugins\EF.ljArchive.XMLJournalWriter.dll"
File "bin\Release\plugins\ZedGraph.dll"
SectionEnd
Section "Templates" SEC03
SetOutPath "$INSTDIR\templates"
File "etc\templates\component.ljt"
File "etc\templates\generator.ljt"
File "etc\templates\simple.ljt"
File "etc\templates\talkread.ljt"
File "etc\templates\unearthed.ljt"
SectionEnd
;Section -AdditionalIcons
; CreateShortCut "$SMPROGRAMS\ljArchive\Uninstall.lnk" "$INSTDIR\uninst.exe"
;SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ljArchive.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\ljArchive.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
; back up old value of .lja
!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".lja" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "ljArchive.Archive" "${Index}-NoBackup"
WriteRegStr HKCR ".lja" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".lja" "" "ljArchive.Archive"
ReadRegStr $0 HKCR "ljArchive.Archive" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "ljArchive.Archive" "" "ljArchive File"
WriteRegStr HKCR "ljArchive.Archive\shell" "" "open"
WriteRegStr HKCR "ljArchive.Archive\DefaultIcon" "" "$INSTDIR\ljArchive.exe,0"
"${Index}-Skip:"
; WriteRegStr HKCR "ljArchive.Archive\shell\open" "" "Open ljArchive File"
WriteRegStr HKCR "ljArchive.Archive\shell\open\command" "" \
'$INSTDIR\ljArchive.exe "%1"'
!undef Index
; Rest of script
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
; Should remove everything previous installer could create
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\templates\unearthed.ljt"
Delete "$INSTDIR\templates\talkread.ljt"
Delete "$INSTDIR\templates\simple.ljt"
Delete "$INSTDIR\templates\generator.ljt"
Delete "$INSTDIR\templates\component.ljt"
Delete "$INSTDIR\plugins\ZedGraph.dll"
Delete "$INSTDIR\plugins\Interop.AgentObjects.dll"
Delete "$INSTDIR\plugins\EF.SimpleMIDI.dll"
Delete "$INSTDIR\plugins\EF.ljArchive.XMLJournalWriter.dll"
Delete "$INSTDIR\plugins\EF.ljArchive.Plugins.WindowsForms.dll"
Delete "$INSTDIR\plugins\EF.ljArchive.Plugins.Core.dll"
Delete "$INSTDIR\plugins\EF.ljArchive.MIDIJournalWriter.dll"
Delete "$INSTDIR\plugins\AxInterop.AgentObjects.dll"
Delete "$INSTDIR\index.htm"
Delete "$INSTDIR\Update.exe"
Delete "$INSTDIR\ljArchive.exe"
Delete "$INSTDIR\ICSharpCode.SharpZipLib.dll"
Delete "$INSTDIR\GenghisLocal.dll"
Delete "$INSTDIR\fr-FR\ljArchive.resources.dll"
Delete "$INSTDIR\EF.ljArchive.Engine.dll"
Delete "$INSTDIR\EF.ljArchive.Common.dll"
Delete "$INSTDIR\CookComputing.XmlRpcLocal.dll"
Delete "$INSTDIR\CommandBar.dll"
Delete "$SMPROGRAMS\ljArchive\Uninstall.lnk"
Delete "$SMPROGRAMS\ljArchive\ljArchive Info.lnk"
Delete "$SMPROGRAMS\ljArchive\ljArchive.lnk"
RMDir "$SMPROGRAMS\ljArchive"
RMDir "$INSTDIR\templates"
RMDir "$INSTDIR\plugins"
RMDir "$INSTDIR\fr-FR"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
;start of restore script
!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".lja" ""
StrCmp $1 "ljArchive.Archive" 0 "${Index}-NoOwn" ; only do this if we own it
ReadRegStr $1 HKCR ".lja" "backup_val"
StrCmp $1 "" 0 "${Index}-Restore" ; if backup="" then delete the whole key
DeleteRegKey HKCR ".lja"
Goto "${Index}-NoOwn"
"${Index}-Restore:"
WriteRegStr HKCR ".lja" "" $1
DeleteRegValue HKCR ".lja" "backup_val"
DeleteRegKey HKCR "ljArchive.Archive" ;Delete key with association settings
"${Index}-NoOwn:"
!undef Index
;rest of script
SetAutoClose true
SectionEnd
; IsDotNETInstalled
;
; Usage:
; Call IsDotNETInstalled
; Pop $0
; StrCmp $0 1 found.NETFramework no.NETFramework
Function IsDotNETInstalled
Push $0
Push $1
Push $2
Push $3
Push $4
ReadRegStr $4 HKEY_LOCAL_MACHINE \
"Software\Microsoft\.NETFramework" "InstallRoot"
# remove trailing back slash
Push $4
Exch $EXEDIR
Exch $EXEDIR
Pop $4
# if the root directory doesn't exist .NET is not installed
IfFileExists $4 0 noDotNET
StrCpy $0 0
EnumStart:
EnumRegKey $2 HKEY_LOCAL_MACHINE \
"Software\Microsoft\.NETFramework\Policy" $0
IntOp $0 $0 + 1
StrCmp $2 "" noDotNET
StrCpy $1 0
EnumPolicy:
EnumRegValue $3 HKEY_LOCAL_MACHINE \
"Software\Microsoft\.NETFramework\Policy\$2" $1
IntOp $1 $1 + 1
StrCmp $3 "" EnumStart
IfFileExists "$4\$2.$3" foundDotNET EnumPolicy
noDotNET:
StrCpy $0 0
Goto done
foundDotNET:
StrCpy $0 1
done:
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd