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\*.example"
158 Section "Command Handlers" SEC03
159 SetOutPath "$INSTDIR\modules"
160 File "..\bin\${BUILD}\modules\cmd_*.so"
163 Section "Modules" SEC04
164 SetOutPath "$INSTDIR\modules"
165 File "..\bin\${BUILD}\modules\m_*.so"
168 Section -AdditionalIcons
170 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
171 CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
172 CreateShortCut "$SMPROGRAMS\InspIRCd\Uninstall.lnk" "$INSTDIR\uninst.exe"
176 WriteUninstaller "$INSTDIR\uninst.exe"
177 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inspircd.exe"
178 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
179 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
180 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\inspircd.exe"
181 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
182 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
183 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
184 MessageBox MB_ICONINFORMATION|MB_OK "InspIRCd was successfully installed. Remember to edit your configuration file in $INSTDIR\conf!"
187 ; Section descriptions
188 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
189 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Actual executable"
190 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Command modules"
191 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Default configuration files"
192 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional non-SSL modules"
193 !insertmacro MUI_FUNCTION_DESCRIPTION_END
196 Function un.onUninstSuccess
198 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
202 SectionSetFlags ${SEC01} 17
203 SectionSetFlags ${SEC03} 17
204 StrCpy $INSTDIR "$PROGRAMFILES\InspIRCd"
208 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
213 DetailPrint "Uninstalling InspIRCd service..."
214 nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --removeservice'
215 Delete "$INSTDIR\${PRODUCT_NAME}.url"
216 Delete "$INSTDIR\uninst.exe"
217 Delete "$INSTDIR\modules\*.so"
218 Delete "$INSTDIR\conf\*.example"
219 Delete "$INSTDIR\*.log"
220 Delete "$INSTDIR\logs\*"
221 Delete "$INSTDIR\data\*"
222 Delete "$INSTDIR\inspircd.exe"
223 Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"
224 Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"
225 Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"
227 RMDir "$SMPROGRAMS\InspIRCd"
228 RMDir "$INSTDIR\modules"
229 RMDir "$INSTDIR\conf"
230 RMDir "$INSTDIR\logs"
231 RMDir "$INSTDIR\data"
234 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
235 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"