]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - win/inspircd.nsi
Update all wiki links to point to the new wiki. This was done automatically with...
[user/henk/code/inspircd.git] / win / inspircd.nsi
1 ; *       +------------------------------------+
2 ; *       | Inspire Internet Relay Chat Daemon |
3 ; *       +------------------------------------+
4 ; *
5 ; *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 ; * See: http://wiki.inspircd.org/Credits
7 ; *
8 ; * This program is free but copyrighted software; see
9 ; *            the file COPYING for details.
10 ; *
11 ; * ---------------------------------------------------
12
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
15                        ;;;; SET THE BUILD TO BE PACKAGED HERE ;;;;
16
17 !define BUILD "release"
18
19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20
21 ; HM NIS Edit Wizard helper defines
22 !define PRODUCT_NAME "InspIRCd"
23 !define PRODUCT_VERSION "1.2"
24 !define PRODUCT_PUBLISHER "InspIRCd Development Team"
25 !define PRODUCT_WEB_SITE "http://www.inspircd.org/"
26 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe"
27 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
28 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
29 !define DOT_MAJOR "2"
30 !define DOT_MINOR "0"
31
32 SetCompressor bzip2
33
34 ; MUI 1.67 compatible ------
35 !include "MUI.nsh"
36
37 ; MUI Settings
38 !define MUI_ABORTWARNING
39 !define MUI_ICON "inspircd.ico"
40 !define MUI_UNICON "inspircd.ico"
41
42 ; Welcome page
43 !insertmacro MUI_PAGE_WELCOME
44 ; License page
45 !define MUI_LICENSEPAGE_CHECKBOX
46 !insertmacro MUI_PAGE_LICENSE "..\docs\COPYING"
47 ; directory page
48 Page directory
49 ; Components page
50 !insertmacro MUI_PAGE_COMPONENTS
51 ; Instfiles page
52 !insertmacro MUI_PAGE_INSTFILES
53 ; Finish page
54 !define MUI_FINISHPAGE_RUN "$INSTDIR\InspGUI.exe"
55 !insertmacro MUI_PAGE_FINISH
56
57 ; Uninstaller pages
58 !insertmacro MUI_UNPAGE_INSTFILES
59
60 ; Language files
61 !insertmacro MUI_LANGUAGE "English"
62
63 ; Reserve files
64 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
65
66 ; MUI end ------
67
68 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
69 OutFile "Setup.exe"
70 InstallDir "$PROGRAMFILES\InspIRCd"
71 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
72 ShowInstDetails show
73 ShowUnInstDetails show
74
75 Function IsDotNetInstalled
76  
77   StrCpy $0 "0"
78   StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.
79   StrCpy $2 0
80  
81   StartEnum:
82     ;Enumerate the versions installed.
83     EnumRegKey $3 HKLM "$1\policy" $2
84     
85     ;If we don't find any versions installed, it's not here.
86     StrCmp $3 "" noDotNet notEmpty
87     
88     ;We found something.
89     notEmpty:
90       ;Find out if the RegKey starts with 'v'.  
91       ;If it doesn't, goto the next key.
92       StrCpy $4 $3 1 0
93       StrCmp $4 "v" +1 goNext
94       StrCpy $4 $3 1 1
95       
96       ;It starts with 'v'.  Now check to see how the installed major version
97       ;relates to our required major version.
98       ;If it's equal check the minor version, if it's greater, 
99       ;we found a good RegKey.
100       IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg
101       ;Check the minor version.  If it's equal or greater to our requested 
102       ;version then we're good.
103       StrCpy $4 $3 1 3
104       IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg
105  
106     goNext:
107       ;Go to the next RegKey.
108       IntOp $2 $2 + 1
109       goto StartEnum
110  
111   yesDotNetReg:
112     ;Now that we've found a good RegKey, let's make sure it's actually
113     ;installed by getting the install path and checking to see if the 
114     ;mscorlib.dll exists.
115     EnumRegValue $2 HKLM "$1\policy\$3" 0
116     ;$2 should equal whatever comes after the major and minor versions 
117     ;(ie, v1.1.4322)
118     StrCmp $2 "" noDotNet
119     ReadRegStr $4 HKLM $1 "InstallRoot"
120     ;Hopefully the install root isn't empty.
121     StrCmp $4 "" noDotNet
122     ;build the actuall directory path to mscorlib.dll.
123     StrCpy $4 "$4$3.$2\mscorlib.dll"
124     IfFileExists $4 yesDotNet noDotNet
125  
126   noDotNet:
127     MessageBox MB_OK "You do not have have v${DOT_MAJOR}.${DOT_MINOR} or greater of the .NET framework installed. This is required for the InspIRCd Monitor, however you can still launch the IRCd manually."
128  
129   yesDotNet:
130     ;Everything checks out.  Go on with the rest of the installation.
131     
132 FunctionEnd
133
134 Section "Binary Executable" SEC01
135   Call IsDotNetInstalled
136   SetOutPath "$TEMP"
137   SetOverwrite ifnewer
138   File "vcredist_x86.exe"
139   ExecWait "$TEMP\vcredist_x86.exe"
140   SetOutPath "$INSTDIR"
141   SetOverwrite ifnewer
142   File "..\bin\${BUILD}\InspGUI.exe"
143   CreateDirectory "$SMPROGRAMS\InspIRCd"
144   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd.lnk" "$INSTDIR\InspGUI.exe"
145   SetOutPath "$INSTDIR\bin"
146   SetOverwrite ifnewer
147   File "..\bin\${BUILD}\bin\inspircd.exe"
148   DetailPrint "Installing InspIRCd service..."
149   nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\bin\inspircd.exe" --installservice'
150 SectionEnd
151
152 Section "Config Files" SEC02
153   SetOutPath "$INSTDIR\conf"
154   File "..\conf\inspircd.motd.example"
155   File "..\conf\inspircd.helpop-full.example"
156   File "..\conf\inspircd.helpop.example"
157   File "..\conf\inspircd.filter.example"
158   File "..\conf\inspircd.conf.example"
159   File "..\conf\opers.conf.example"
160   File "..\conf\modules.conf.example"
161   File "..\conf\links.conf.example"
162   File "..\conf\inspircd.censor.example"
163   File "..\conf\inspircd.rules.example"
164   File "..\conf\inspircd.quotes.example"
165   SetOutPath "$INSTDIR\conf\test"
166   File "..\conf\test\test.conf"
167 SectionEnd
168
169 Section "Command Handlers" SEC03
170   SetOutPath "$INSTDIR\lib"
171   File "..\bin\${BUILD}\lib\cmd_*.so"
172 SectionEnd
173
174 Section "Modules" SEC04
175   SetOutPath "$INSTDIR\modules"
176   File "..\bin\${BUILD}\modules\m_*.so"
177 SectionEnd
178
179 Section  "SSL Modules" SEC05
180   SetOutPath "$INSTDIR\bin"
181   SetOverwrite ifnewer
182   File "..\bin\${BUILD}\bin\libgcrypt-11.dll"
183   File "..\bin\${BUILD}\bin\libgnutls-13.dll"
184   File "..\bin\${BUILD}\bin\libgnutls-extra-13.dll"
185   File "..\bin\${BUILD}\bin\libgnutls-openssl-13.dll"
186   File "..\bin\${BUILD}\bin\libgpg-error-0.dll"
187   File "..\bin\${BUILD}\bin\libopencdk-8.dll"
188   File "..\bin\${BUILD}\bin\libtasn1-3.dll"
189   SetOutPath "$INSTDIR\modules"
190   File "c:\temp\m_ssl_gnutls.so"
191   File "c:\temp\m_sslinfo.so"
192   File "c:\temp\m_ssl_oper_cert.so"
193   SetOutPath "$INSTDIR\conf"
194   SetOverwrite off
195   File "key.pem"
196   File "cert.pem"
197 SectionEnd
198
199 Section  "Regexp Modules" SEC06
200   SetOutPath "$INSTDIR\bin"
201   SetOverwrite ifnewer
202   File "..\bin\${BUILD}\bin\pcre.dll"
203   SetOutPath "$INSTDIR\modules"
204   File "c:\temp\m_filter_pcre.so"
205 SectionEnd
206
207 Section -AdditionalIcons
208   SetOutPath $INSTDIR
209   WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
210   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
211   CreateShortCut "$SMPROGRAMS\InspIRCd\Uninstall.lnk" "$INSTDIR\uninst.exe"
212 SectionEnd
213
214 Section -Post
215   WriteUninstaller "$INSTDIR\uninst.exe"
216   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\bin\inspircd.exe"
217   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
218   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
219   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\inspircd.exe"
220   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
221   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
222   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
223   MessageBox MB_ICONINFORMATION|MB_OK "InspIRCd was successfully installed. Remember to edit your configuration file in $INSTDIR\conf!"
224 SectionEnd
225
226 ; Section descriptions
227 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
228   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Actual executable"
229   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Command modules"
230   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Default configuration files"
231   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional non-SSL modules"
232   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "SSL modules and GnuTLS DLL libraries"
233   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "Regular expression module and PCRE DLL library"
234 !insertmacro MUI_FUNCTION_DESCRIPTION_END
235
236
237 Function un.onUninstSuccess
238   HideWindow
239   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
240 FunctionEnd
241
242 Function .onInit
243   SectionSetFlags ${SEC01} 17
244   SectionSetFlags ${SEC03} 17
245   StrCpy $INSTDIR "$PROGRAMFILES\InspIRCd"
246 FunctionEnd
247
248 Function un.onInit
249   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
250   Abort
251 FunctionEnd
252
253 Section Uninstall
254   DetailPrint "Uninstalling InspIRCd service..."
255   nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\bin\inspircd.exe" --removeservice'
256   Delete "$INSTDIR\${PRODUCT_NAME}.url"
257   Delete "$INSTDIR\uninst.exe"
258   Delete "$INSTDIR\modules\m_*.so"
259   Delete "$INSTDIR\lib\cmd_*.so"
260   Delete "$INSTDIR\conf\inspircd.quotes.example"
261   Delete "$INSTDIR\conf\inspircd.rules.example"
262   Delete "$INSTDIR\conf\inspircd.censor.example"
263   Delete "$INSTDIR\conf\inspircd.conf.example"
264   Delete "$INSTDIR\conf\inspircd.filter.example"
265   Delete "$INSTDIR\conf\inspircd.helpop.example"
266   Delete "$INSTDIR\conf\inspircd.helpop-full.example"
267   Delete "$INSTDIR\conf\inspircd.motd.example"
268   Delete "$INSTDIR\bin\inspircd.exe"
269   Delete "$INSTDIR\bin\*.dll"
270   Delete "$INSTDIR\InspGUI.exe"
271   Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"
272   Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"
273   Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"
274
275   RMDir "$SMPROGRAMS\InspIRCd"
276   RMDir "$INSTDIR\modules"
277   RMDir "$INSTDIR\lib"
278   RMDir "$INSTDIR\conf"
279   RMDir "$INSTDIR\bin"
280   RMDir "$INSTDIR"
281
282   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
283   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
284   SetAutoClose true
285 SectionEnd