forked from mguessan/davmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
davmail-setup64.nsi
215 lines (183 loc) · 7.48 KB
/
davmail-setup64.nsi
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
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "DavMail"
!define PRODUCT_VERSION "${VERSION}"
!define PRODUCT_PUBLISHER "Mickaël Guessant"
!define PRODUCT_WEB_SITE "http://sourceforge.net/projects/davmail"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\davmail64.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI2.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "src\license.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\davmail64.exe"
!define MUI_FINISHPAGE_SHOWREADME "" #Used as auto start option
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Always launch DavMail at log on"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION AddRunKey
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "dist\davmail-${PRODUCT_VERSION}-setup64.exe"
InstallDir "$PROGRAMFILES64\DavMail"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
LangString PAGE_TITLE ${LANG_ENGLISH} "Title"
LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle"
Function AddRunKey
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\Run" "DavMail" "$INSTDIR\davmail64.exe"
FunctionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section
Push $5
loop:
push "davmail64.exe"
processwork::existsprocess
pop $5
IntCmp $5 0 no_quest
MessageBox MB_RETRYCANCEL|MB_ICONSTOP 'DavMail must be closed during this installation.$\r$\n Close DavMail now, or press "Retry" to automatically close DavMail and continue or press "Cancel" to cancel the installation entirely.' IDCANCEL BailOut
push "davmail64.exe"
processwork::KillProcess
Sleep 2000
Goto loop
BailOut:
Abort
no_quest:
SectionEnd
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite try
File "dist\davmail64.exe"
CreateDirectory "$SMPROGRAMS\DavMail"
CreateShortCut "$SMPROGRAMS\DavMail\DavMail.lnk" "$INSTDIR\davmail64.exe"
CreateShortCut "$DESKTOP\DavMail.lnk" "$INSTDIR\davmail64.exe"
File "dist\davmail.jar"
File "dist\davmail64.exe"
File "dist\davmailservice64.exe"
SetOutPath "$INSTDIR\lib"
File "dist\lib\activation-1.1.1.jar"
File "dist\lib\commons-codec-1.11.jar"
File "dist\lib\commons-collections-3.1.jar"
File "dist\lib\commons-httpclient-3.1.jar"
File "dist\lib\httpcore-4.4.10.jar"
File "dist\lib\httpclient-4.5.6.jar"
File "dist\lib\commons-logging-1.0.4.jar"
File "dist\lib\htmlcleaner-2.21.jar"
File "dist\lib\jackrabbit-webdav-2.14.6.jar"
File "dist\lib\jcharset-2.0.jar"
File "dist\lib\jcifs-1.3.14.jar"
File "dist\lib\jdom-1.0.jar"
File "dist\lib\jettison-1.4.0.jar"
File "dist\lib\log4j-1.2.16.jar"
File "dist\lib\javax.mail-1.5.6.jar"
File "dist\lib\slf4j-api-1.7.25.jar"
File "dist\lib\slf4j-log4j12-1.7.25.jar"
File "dist\lib\stax-api-1.0.1.jar"
File "dist\lib\stax2-api-3.1.1.jar"
File "dist\lib\winrun4j-0.4.5.jar"
File "dist\lib\woodstox-core-6.2.0.jar"
SectionEnd
Section -AdditionalIcons
SetOutPath $INSTDIR
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\DavMail\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\DavMail\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\davmail64.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\davmail64.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}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) has been removed from your system."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
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
Push $5
loop:
push "davmail64.exe"
processwork::existsprocess
pop $5
IntCmp $5 0 no_quest
MessageBox MB_RETRYCANCEL|MB_ICONSTOP 'DavMail must be closed during this installation.$\r$\n Close DavMail now, or press "Retry" to automatically close DavMail and continue or press "Cancel" to cancel the installation entirely.' IDCANCEL BailOut
push "davmail64.exe"
processwork::KillProcess
Sleep 2000
Goto loop
BailOut:
Abort
no_quest:
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\lib\activation-1.1.1.jar"
Delete "$INSTDIR\lib\commons-codec-1.11.jar"
Delete "$INSTDIR\lib\commons-collections-3.1.jar"
Delete "$INSTDIR\lib\commons-httpclient-3.1.jar"
Delete "$INSTDIR\lib\httpcore-4.4.10.jar"
Delete "$INSTDIR\lib\httpclient-4.5.6.jar"
Delete "$INSTDIR\lib\commons-logging-1.0.4.jar"
Delete "$INSTDIR\lib\htmlcleaner-2.21.jar"
Delete "$INSTDIR\lib\jackrabbit-webdav-2.14.6.jar"
Delete "$INSTDIR\lib\jcharset-2.0.jar"
Delete "$INSTDIR\lib\jcifs-1.3.14.jar"
Delete "$INSTDIR\lib\jdom-1.0.jar"
Delete "$INSTDIR\lib\jettison-1.4.0.jar"
Delete "$INSTDIR\lib\log4j-1.2.16.jar"
Delete "$INSTDIR\lib\javax.mail-1.5.6.jar"
Delete "$INSTDIR\lib\slf4j-api-1.7.25.jar"
Delete "$INSTDIR\lib\slf4j-log4j12-1.7.25.jar"
Delete "$INSTDIR\lib\stax-api-1.0.1.jar"
Delete "$INSTDIR\lib\stax2-api-3.1.1.jar"
Delete "$INSTDIR\lib\winrun4j-0.4.5.jar"
Delete "$INSTDIR\lib\woodstox-core-6.2.0.jar"
Delete "$INSTDIR\davmailservice64.exe"
Delete "$INSTDIR\davmail64.exe"
Delete "$INSTDIR\davmail.log"
Delete "$INSTDIR\davmail.jar"
Delete "$SMPROGRAMS\DavMail\Uninstall.lnk"
Delete "$SMPROGRAMS\DavMail\Website.lnk"
Delete "$DESKTOP\DavMail.lnk"
Delete "$SMPROGRAMS\DavMail\DavMail.lnk"
Delete "$SMPROGRAMS\DavMail\DavMail Console.lnk"
RMDir "$SMPROGRAMS\DavMail"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR"
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "DavMail"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd