]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - win/inspircd.nsi
25b97cd929751d338e694c62d8c245dcbce8959a
[user/henk/code/inspircd.git] / win / inspircd.nsi
1 ; Script generated by the HM NIS Edit Script Wizard.\r
2 \r
3 ; HM NIS Edit Wizard helper defines\r
4 !define PRODUCT_NAME "InspIRCd"\r
5 !define PRODUCT_VERSION "1.1"\r
6 !define PRODUCT_PUBLISHER "InspIRCd Development Team"\r
7 !define PRODUCT_WEB_SITE "http://www.inspircd.org/"\r
8 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe"\r
9 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\r
10 !define PRODUCT_UNINST_ROOT_KEY "HKLM"\r
11 !define DOT_MAJOR "2"\r
12 !define DOT_MINOR "0"\r
13 \r
14 SetCompressor bzip2\r
15 \r
16 ; MUI 1.67 compatible ------\r
17 !include "MUI.nsh"\r
18 \r
19 ; MUI Settings\r
20 !define MUI_ABORTWARNING\r
21 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow2-install.ico"\r
22 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow2-uninstall.ico"\r
23 \r
24 ; Welcome page\r
25 !insertmacro MUI_PAGE_WELCOME\r
26 ; License page\r
27 !define MUI_LICENSEPAGE_CHECKBOX\r
28 !insertmacro MUI_PAGE_LICENSE "..\docs\COPYING"\r
29 ; Components page\r
30 !insertmacro MUI_PAGE_COMPONENTS\r
31 ; Directory page\r
32 !insertmacro MUI_PAGE_DIRECTORY\r
33 ; Instfiles page\r
34 !insertmacro MUI_PAGE_INSTFILES\r
35 ; Finish page\r
36 !define MUI_FINISHPAGE_RUN "$INSTDIR\InspGUI.exe"\r
37 !define MUI_FINISHPAGE_RUN_PARAMETERS "--nofork"\r
38 !insertmacro MUI_PAGE_FINISH\r
39 \r
40 ; Uninstaller pages\r
41 !insertmacro MUI_UNPAGE_INSTFILES\r
42 \r
43 ; Language files\r
44 !insertmacro MUI_LANGUAGE "English"\r
45 \r
46 ; Reserve files\r
47 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS\r
48 \r
49 ; MUI end ------\r
50 \r
51 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"\r
52 OutFile "Setup.exe"\r
53 InstallDir "$PROGRAMFILES\InspIRCd"\r
54 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""\r
55 ShowInstDetails show\r
56 ShowUnInstDetails show\r
57 \r
58 Function IsDotNetInstalled\r
59  \r
60   StrCpy $0 "0"\r
61   StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.\r
62   StrCpy $2 0\r
63  \r
64   StartEnum:\r
65     ;Enumerate the versions installed.\r
66     EnumRegKey $3 HKLM "$1\policy" $2\r
67     \r
68     ;If we don't find any versions installed, it's not here.\r
69     StrCmp $3 "" noDotNet notEmpty\r
70     \r
71     ;We found something.\r
72     notEmpty:\r
73       ;Find out if the RegKey starts with 'v'.  \r
74       ;If it doesn't, goto the next key.\r
75       StrCpy $4 $3 1 0\r
76       StrCmp $4 "v" +1 goNext\r
77       StrCpy $4 $3 1 1\r
78       \r
79       ;It starts with 'v'.  Now check to see how the installed major version\r
80       ;relates to our required major version.\r
81       ;If it's equal check the minor version, if it's greater, \r
82       ;we found a good RegKey.\r
83       IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg\r
84       ;Check the minor version.  If it's equal or greater to our requested \r
85       ;version then we're good.\r
86       StrCpy $4 $3 1 3\r
87       IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg\r
88  \r
89     goNext:\r
90       ;Go to the next RegKey.\r
91       IntOp $2 $2 + 1\r
92       goto StartEnum\r
93  \r
94   yesDotNetReg:\r
95     ;Now that we've found a good RegKey, let's make sure it's actually\r
96     ;installed by getting the install path and checking to see if the \r
97     ;mscorlib.dll exists.\r
98     EnumRegValue $2 HKLM "$1\policy\$3" 0\r
99     ;$2 should equal whatever comes after the major and minor versions \r
100     ;(ie, v1.1.4322)\r
101     StrCmp $2 "" noDotNet\r
102     ReadRegStr $4 HKLM $1 "InstallRoot"\r
103     ;Hopefully the install root isn't empty.\r
104     StrCmp $4 "" noDotNet\r
105     ;build the actuall directory path to mscorlib.dll.\r
106     StrCpy $4 "$4$3.$2\mscorlib.dll"\r
107     IfFileExists $4 yesDotNet noDotNet\r
108  \r
109   noDotNet:\r
110     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."\r
111  \r
112   yesDotNet:\r
113     ;Everything checks out.  Go on with the rest of the installation.\r
114     \r
115 FunctionEnd\r
116 \r
117 Section "Binary Executable" SEC01\r
118   Call IsDotNetInstalled\r
119   SetOutPath "$INSTDIR"\r
120   SetOverwrite ifnewer\r
121   File "..\bin\debug\InspGUI.exe"\r
122   CreateDirectory "$SMPROGRAMS\InspIRCd"\r
123   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd.lnk" "$INSTDIR\InspGUI.exe"\r
124   SetOutPath "$INSTDIR\bin"\r
125   SetOverwrite ifnewer\r
126   File "..\bin\debug\bin\inspircd.exe"\r
127 SectionEnd\r
128 \r
129 Section "Config Files" SEC02\r
130   SetOutPath "$INSTDIR\conf"\r
131   File "..\conf\inspircd.motd.example"\r
132   File "..\conf\inspircd.helpop-full.example"\r
133   File "..\conf\inspircd.helpop.example"\r
134   File "..\conf\inspircd.filter.example"\r
135   File "..\docs\inspircd.conf.example"\r
136   File "..\conf\inspircd.censor.example"\r
137   File "..\conf\inspircd.rules.example"\r
138   File "..\conf\inspircd.quotes.example"\r
139 SectionEnd\r
140 \r
141 Section "Command Handlers" SEC03\r
142   SetOutPath "$INSTDIR\lib"\r
143   File "..\bin\debug\lib\cmd_*.so"\r
144 SectionEnd\r
145 \r
146 Section "Modules" SEC04\r
147   SetOutPath "$INSTDIR\modules"\r
148   File "..\bin\debug\modules\*.so"\r
149 SectionEnd\r
150 \r
151 Section -AdditionalIcons\r
152   SetOutPath $INSTDIR\r
153   WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"\r
154   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"\r
155   CreateShortCut "$SMPROGRAMS\InspIRCd\Uninstall.lnk" "$INSTDIR\uninst.exe"\r
156 SectionEnd\r
157 \r
158 Section -Post\r
159   WriteUninstaller "$INSTDIR\uninst.exe"\r
160   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\bin\inspircd.exe"\r
161   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"\r
162   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"\r
163   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\inspircd.exe"\r
164   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"\r
165   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"\r
166   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"\r
167 SectionEnd\r
168 \r
169 ; Section descriptions\r
170 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN\r
171   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Actual Executable"\r
172   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Default Config Files"\r
173   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Command Modules"\r
174   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional Modules"\r
175 !insertmacro MUI_FUNCTION_DESCRIPTION_END\r
176 \r
177 \r
178 Function un.onUninstSuccess\r
179   HideWindow\r
180   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."\r
181 FunctionEnd\r
182 \r
183 Function un.onInit\r
184   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2\r
185   Abort\r
186 FunctionEnd\r
187 \r
188 Section Uninstall\r
189   Delete "$INSTDIR\${PRODUCT_NAME}.url"\r
190   Delete "$INSTDIR\uninst.exe"\r
191   Delete "$INSTDIR\modules\m_*.so"\r
192   Delete "$INSTDIR\lib\cmd_*.so"\r
193   Delete "$INSTDIR\conf\inspircd.quotes.example"\r
194   Delete "$INSTDIR\conf\inspircd.rules.example"\r
195   Delete "$INSTDIR\conf\inspircd.censor.example"\r
196   Delete "$INSTDIR\conf\inspircd.conf.example"\r
197   Delete "$INSTDIR\conf\inspircd.filter.example"\r
198   Delete "$INSTDIR\conf\inspircd.helpop.example"\r
199   Delete "$INSTDIR\conf\inspircd.helpop-full.example"\r
200   Delete "$INSTDIR\conf\inspircd.motd.example"\r
201   Delete "$INSTDIR\bin\inspircd.exe"\r
202   Delete "$INSTDIR\InspGUI.exe"\r
203 \r
204   Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"\r
205   Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"\r
206   Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"\r
207 \r
208   RMDir "$SMPROGRAMS\InspIRCd"\r
209   RMDir "$INSTDIR\modules"\r
210   RMDir "$INSTDIR\lib"\r
211   RMDir "$INSTDIR\conf"\r
212   RMDir "$INSTDIR\bin"\r
213   RMDir "$INSTDIR"\r
214 \r
215   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"\r
216   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"\r
217   SetAutoClose true\r
218 SectionEnd\r