2 ; InspIRCd -- Internet Relay Chat Daemon
4 ; Copyright (C) 2011 Adam <Adam@anope.org>
5 ; Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
6 ; Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
8 ; This file is part of InspIRCd. InspIRCd is free software: you can
9 ; redistribute it and/or modify it under the terms of the GNU General Public
10 ; License as published by the Free Software Foundation, version 2.
12 ; This program is distributed in the hope that it will be useful, but WITHOUT
13 ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24 ;;;; SET THE BUILD TO BE PACKAGED HERE ;;;;
26 !define BUILD "release"
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ; HM NIS Edit Wizard helper defines
31 !define PRODUCT_NAME "InspIRCd"
32 !define PRODUCT_VERSION "2.0"
33 !define PRODUCT_PUBLISHER "InspIRCd Development Team"
34 !define PRODUCT_WEB_SITE "http://www.inspircd.org/"
35 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe"
36 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
37 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
43 ; MUI 1.67 compatible ------
47 !define MUI_ABORTWARNING
48 !define MUI_ICON "inspircd.ico"
49 !define MUI_UNICON "inspircd.ico"
52 !insertmacro MUI_PAGE_WELCOME
54 !define MUI_LICENSEPAGE_CHECKBOX
55 !insertmacro MUI_PAGE_LICENSE "..\docs\COPYING"
59 !insertmacro MUI_PAGE_COMPONENTS
61 !insertmacro MUI_PAGE_INSTFILES
64 !insertmacro MUI_UNPAGE_INSTFILES
67 !insertmacro MUI_LANGUAGE "English"
70 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
74 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
75 OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}-Setup.exe"
76 InstallDir "$PROGRAMFILES\InspIRCd"
77 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
79 ShowUnInstDetails show
81 Function IsDotNetInstalled
84 StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.
88 ;Enumerate the versions installed.
89 EnumRegKey $3 HKLM "$1\policy" $2
91 ;If we don't find any versions installed, it's not here.
92 StrCmp $3 "" noDotNet notEmpty
96 ;Find out if the RegKey starts with 'v'.
97 ;If it doesn't, goto the next key.
99 StrCmp $4 "v" +1 goNext
102 ;It starts with 'v'. Now check to see how the installed major version
103 ;relates to our required major version.
104 ;If it's equal check the minor version, if it's greater,
105 ;we found a good RegKey.
106 IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg
107 ;Check the minor version. If it's equal or greater to our requested
108 ;version then we're good.
110 IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg
113 ;Go to the next RegKey.
118 ;Now that we've found a good RegKey, let's make sure it's actually
119 ;installed by getting the install path and checking to see if the
120 ;mscorlib.dll exists.
121 EnumRegValue $2 HKLM "$1\policy\$3" 0
122 ;$2 should equal whatever comes after the major and minor versions
124 StrCmp $2 "" noDotNet
125 ReadRegStr $4 HKLM $1 "InstallRoot"
126 ;Hopefully the install root isn't empty.
127 StrCmp $4 "" noDotNet
128 ;build the actuall directory path to mscorlib.dll.
129 StrCpy $4 "$4$3.$2\mscorlib.dll"
130 IfFileExists $4 yesDotNet noDotNet
133 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."
136 ;Everything checks out. Go on with the rest of the installation.
140 Section "Binary Executable" SEC01
141 Call IsDotNetInstalled
142 CreateDirectory "$SMPROGRAMS\InspIRCd"
143 CreateDirectory "$INSTDIR\logs"
144 CreateDirectory "$INSTDIR\data"
145 CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd.lnk" "$INSTDIR\inspircd.exe"
146 SetOutPath "$INSTDIR"
148 File "..\bin\${BUILD}\inspircd.exe"
149 DetailPrint "Installing InspIRCd service..."
150 nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --installservice'
153 Section "Config Files" SEC02
154 SetOutPath "$INSTDIR\conf"
155 File "..\docs\conf\*.example"
156 SetOutPath "$INSTDIR\conf\aliases"
157 File "..\docs\conf\aliases\*.example"
158 SetOutPath "$INSTDIR\conf\modules"
159 File "..\docs\conf\modules\modules.*"
162 Section "Command Handlers" SEC03
163 SetOutPath "$INSTDIR\modules"
164 File "..\bin\${BUILD}\modules\cmd_*.so"
167 Section "Modules" SEC04
168 SetOutPath "$INSTDIR\modules"
169 File "..\bin\${BUILD}\modules\m_*.so"
170 ; Copy DLLs required for modules
171 SetOutPath "$INSTDIR"
172 File /nonfatal "*.dll"
173 File "make_gnutls_cert.bat"
176 Section -AdditionalIcons
178 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
179 CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
180 CreateShortCut "$SMPROGRAMS\InspIRCd\Uninstall.lnk" "$INSTDIR\uninst.exe"
184 WriteUninstaller "$INSTDIR\uninst.exe"
185 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inspircd.exe"
186 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
187 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
188 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\inspircd.exe"
189 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
190 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
191 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
192 MessageBox MB_ICONINFORMATION|MB_OK "InspIRCd was successfully installed. Remember to edit your configuration file in $INSTDIR\conf!"
195 ; Section descriptions
196 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
197 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Actual executable"
198 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Command modules"
199 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Default configuration files"
200 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional non-SSL modules"
201 !insertmacro MUI_FUNCTION_DESCRIPTION_END
204 Function un.onUninstSuccess
206 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
210 SectionSetFlags ${SEC01} 17
211 SectionSetFlags ${SEC03} 17
212 StrCpy $INSTDIR "$PROGRAMFILES\InspIRCd"
216 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
221 DetailPrint "Uninstalling InspIRCd service..."
222 nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --removeservice'
223 Delete "$INSTDIR\${PRODUCT_NAME}.url"
224 Delete "$INSTDIR\uninst.exe"
225 Delete "$INSTDIR\modules\*.so"
226 Delete "$INSTDIR\conf\*.example"
227 Delete "$INSTDIR\conf\aliases\*.example"
228 Delete "$INSTDIR\conf\modules\*.example"
229 Delete "$INSTDIR\*.log"
230 Delete "$INSTDIR\logs\*"
231 Delete "$INSTDIR\data\*"
232 Delete "$INSTDIR\*.dll"
233 Delete "$INSTDIR\make_gnutls_cert.bat"
234 Delete "$INSTDIR\inspircd.exe"
235 Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"
236 Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"
237 Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"
239 RMDir "$SMPROGRAMS\InspIRCd"
240 RMDir "$INSTDIR\modules"
241 RMDir "$INSTDIR\conf"
242 RMDir "$INSTDIR\logs"
243 RMDir "$INSTDIR\data"
246 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
247 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"