/[cvs]/joko/ToolBox/Windows/w2hfax-installer/w2hfax.nsi
ViewVC logotype

Contents of /joko/ToolBox/Windows/w2hfax-installer/w2hfax.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Mar 23 01:56:03 2005 UTC (19 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.1: +194 -6 lines
+ Added support for downloading and setting up "Python" and "Python for Win32 Extensions"

1 ; w2hfax.nsi
2 ;
3 ; This script can install w2hfax and required packages:
4 ; Python 2.4, PythonWin, Redmon, Ghostscript and Ghostview
5 ; has uninstall support and (optionally) installs start menu shortcuts.
6 ;
7
8
9
10 ; --------------------------------
11 ; The name of the installer
12 ; --------------------------------
13 Name "w2hfax"
14
15 ; The file to write
16 OutFile "w2hfax_setup.exe"
17
18 ; The default installation directory
19 InstallDir $PROGRAMFILES\w2hfax-test
20
21 ; Registry key to check for directory (so if you install again, it will
22 ; overwrite the old one automatically)
23 InstallDirRegKey HKLM "Software\NSIS_w2hfax" "Install_Dir"
24
25 Var redmonInstDir
26
27
28
29
30 ; --------------------------------
31 ; Pages
32 ; --------------------------------
33
34 Page components
35 Page directory
36 Page instfiles
37
38 UninstPage uninstConfirm
39 UninstPage instfiles
40
41
42
43 ; --------------------------------
44 ; The stuff to install
45 ; --------------------------------
46
47
48 Var python_path
49 Var python_version
50 Var python_url
51 Var python_msi
52
53
54 Section "Python" IDX_PYTHON
55 Call install_python
56 Call check_python
57 SectionEnd
58
59 Section "Python for Win32 Extensions" IDX_PYTHONWIN
60 Call install_pythonwin
61 Call check_pythonwin
62 SectionEnd
63
64
65 Section "w2hfax" IDX_W2HFAX
66
67 SetDetailsPrint both
68 DetailPrint "Installing w2hfax..."
69
70 ;SectionIn RO
71
72 ; Set output path to the installation directory.
73 SetOutPath $INSTDIR
74
75 ; Put file there
76 File "C:\tmp\w2hfax-make\w2hfax\*.*"
77
78 ; Write the installation path into the registry
79 WriteRegStr HKLM SOFTWARE\NSIS_w2hfax "Install_Dir" "$INSTDIR"
80
81 ; Write the uninstall keys for Windows
82 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "DisplayName" "w2hfax"
83 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "UninstallString" '"$INSTDIR\uninstall.exe"'
84 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "NoModify" 1
85 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "NoRepair" 1
86 WriteUninstaller "uninstall.exe"
87
88 DetailPrint "Registering w2hfax COM-Server..."
89
90 ; register "w2hfax COM-Server" (a python class) using the PyWin library
91 ;nsExec::Exec "$INSTDIR\hfaxcom.py"
92 ; TODO: Use $pythonInstDir here!
93 nsExec::Exec "python $INSTDIR\hfaxcom.py"
94
95 ; TODO: (pre-)configure w2hfax here!
96
97 SectionEnd
98
99
100 Section "RedMon Port Redirection Monitor" IDX_REDMON
101
102 SetDetailsPrint both
103 DetailPrint "Installing RedMon Port Redirection Monitor..."
104
105 ;SectionIn RO
106
107 StrCpy $redmonInstDir "$PROGRAMFILES\redmon17de"
108
109 ; Set output path to the installation directory.
110 SetOutPath $redmonInstDir
111
112 ; Put file there
113 File "C:\tmp\w2hfax-make\redmon17de\*.*"
114 ; TODO: integrate into here to use current $INSTDIR
115 File "redmon_configure.reg"
116
117 ; Write the installation path into the registry
118 WriteRegStr HKLM SOFTWARE\NSIS_redmon17de "Install_Dir" "$redmonInstDir"
119
120 ; Write the uninstall keys for Windows
121 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\redmon17de" "DisplayName" "redmon17de"
122 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\redmon17de" "UninstallString" '"$redmonInstDir\uninstall.exe"'
123 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\redmon17de" "NoModify" 1
124 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\redmon17de" "NoRepair" 1
125 WriteUninstaller "uninstall.exe"
126
127 DetailPrint "Registering RedMon Port Redirection Monitor..."
128 nsExec::Exec "$redmonInstDir\setup.exe"
129
130 DetailPrint "Configuring RedMon Port Redirection Monitor..."
131 ; TODO: integrate into here to use current $INSTDIR
132 nsExec::Exec "$redmonInstDir\redmon_configure.reg"
133
134 SectionEnd
135
136
137 ; Optional section (can be disabled by the user)
138 Section "Start Menu Shortcuts" IDX_STARTMENU
139
140 SetDetailsPrint both
141 DetailPrint "Installing Start Menu and Desktop Shortcuts..."
142
143 CreateDirectory "$SMPROGRAMS\w2hfax"
144 CreateShortCut "$SMPROGRAMS\w2hfax\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
145 CreateShortCut "$SMPROGRAMS\w2hfax\w2hfax.lnk" "$INSTDIR\w2hfax.exe" "" "$INSTDIR\w2hfax.exe" 0
146
147 SectionEnd
148
149
150
151 ; --------------------------------
152 ; Uninstaller
153 ; --------------------------------
154
155 Section "Uninstall" IDX_UNINSTALL
156
157 ; ------------------
158 ; uninstall redmon
159 ; ------------------
160 ReadRegStr $redmonInstDir HKLM "Software\NSIS_redmon17de" "Install_Dir"
161 IfFileExists $redmonInstDir\unredmon.exe found
162 Messagebox MB_OK "Uninstall path incorrect"
163 Abort
164 found:
165 nsExec::Exec "$redmonInstDir\unredmon.exe"
166 ;Delete $redmonInstDir\uninstall.exe
167 Delete "$redmonInstDir\*.*"
168 RMDir "$redmonInstDir"
169
170
171 ; ------------------
172 ; uninstall w2hfax
173 ; ------------------
174
175 ; Remove registry keys
176 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax"
177 DeleteRegKey HKLM SOFTWARE\NSIS_w2hfax
178
179 ; Remove registry keys
180 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\redmon17de"
181 DeleteRegKey HKLM SOFTWARE\NSIS_redmon17de
182
183
184 ; Remove files and uninstaller
185 ;Delete $INSTDIR\makensisw.exe
186 ;Delete $INSTDIR\uninstall.exe
187 Delete "$INSTDIR\*.*"
188
189 ; Remove shortcuts, if any
190 Delete "$SMPROGRAMS\w2hfax\*.*"
191
192 ; Remove directories used
193 RMDir "$SMPROGRAMS\w2hfax"
194 RMDir "$INSTDIR"
195
196 SectionEnd
197
198
199 ; --------------------------------
200 ; Functions
201 ; --------------------------------
202
203 Function check_python
204
205 SetDetailsPrint both
206 DetailPrint "Checking for Python installation..."
207
208 ClearErrors
209
210 ReadRegStr $python_path HKLM Software\Python\PythonCore\2.4\InstallPath ""
211 IfErrors +3
212 StrCpy $python_version "2.4"
213 Goto found_python
214
215 ReadRegStr $python_path HKLM Software\Python\PythonCore\2.3\InstallPath ""
216 IfErrors +3
217 StrCpy $python_version "2.3"
218 Goto found_python
219
220 ReadRegStr $python_path HKLM Software\Python\PythonCore\2.2\InstallPath ""
221 IfErrors +3
222 StrCpy $python_version "2.2"
223 Goto found_python
224
225 Goto no_python
226
227 found_python:
228 ; check if python.exe is really present
229 ClearErrors
230 IfFileExists $python_path\python.exe 0 +2
231 DetailPrint "Found Python $python_version at: $python_path."
232 Return
233
234 no_python:
235 ; error: no python
236 ;MessageBox MB_OK "No Python installation found (checked HKLM\Software\Python\PythonCore\2.3 and HKLM\Software\Python\PythonCore\2.2)."
237 ;Call install_python
238 SetErrors
239
240 FunctionEnd
241
242
243
244 Function install_python
245
246 IfFileExists "$EXEDIR\python-2.4.msi" 0 +2
247 StrCpy $python_msi "$EXEDIR\python-2.4.msi"
248 IfFileExists "$INSTDIR\python-2.4.msi" 0 +2
249 StrCpy $python_msi "$INSTDIR\python-2.4.msi"
250
251 ;MessageBox MB_OK $python_msi
252 StrCmp $python_msi "" 0 run_setup
253
254 SetDetailsPrint textonly
255 DetailPrint "Downloading Python 2.3"
256 SetDetailsPrint listonly
257
258 StrCpy $python_url "http://www.python.org/ftp/python/2.4/python-2.4.msi"
259 MessageBox MB_YESNO "Download Python 2.3 from $python_url?" IDYES NoCancelAbort
260 ;Abort ; causes uninstaller to not quit.
261 Return
262
263 NoCancelAbort:
264 NSISdl::download $python_url $INSTDIR\python-2.4.msi
265
266 run_setup:
267 IfFileExists $python_msi 0 +10
268 SetDetailsPrint textonly
269 DetailPrint "Installing Python..."
270 SetDetailsPrint listonly
271 ExecWait 'msiexec /i "$python_msi"'
272
273 FunctionEnd
274
275
276 Function check_pythonwin
277
278 SetDetailsPrint both
279 DetailPrint "Checking for installation of 'Python for Win32 Extensions'..."
280 IfFileExists "$python_path\Lib\site-packages\win32com\server\register.py" 0 no_pythonwin
281 Return
282
283 no_pythonwin:
284 SetErrors
285
286 FunctionEnd
287
288
289 Function install_pythonwin
290
291 ; installer exe
292 StrCmp $python_version "2.2" 0 +2
293 StrCpy $R0 "pywin32-203.win32-py2.2.exe"
294 StrCmp $python_version "2.3" 0 +2
295 StrCpy $R0 "pywin32-203.win32-py2.3.exe"
296 StrCmp $python_version "2.4" 0 +2
297 StrCpy $R0 "pywin32-203.win32-py2.4.exe"
298
299 ; download base
300 StrCpy $R1 "http://mesh.dl.sourceforge.net/sourceforge/pywin32/$R0"
301
302 IfFileExists "$EXEDIR\$R0" 0 +2
303 StrCpy $R2 "$EXEDIR\R0"
304 IfFileExists "$INSTDIR\$R0" 0 +2
305 StrCpy $R2 "$INSTDIR\$R0"
306
307 ;MessageBox MB_OK $R2
308 StrCmp $R2 "" 0 run_setup
309
310 SetDetailsPrint textonly
311 DetailPrint "Downloading 'Python for Win32 Extensions'"
312 SetDetailsPrint listonly
313
314 MessageBox MB_YESNO "Download 'Python for Win32 Extensions' from $R1?" IDYES NoCancelAbort
315 ;Abort ; causes uninstaller to not quit.
316 Return
317
318 NoCancelAbort:
319 NSISdl::download $R1 $INSTDIR\$R0
320 StrCpy $R2 "$INSTDIR\$R0"
321
322 run_setup:
323 IfFileExists $R2 0 +10
324 SetDetailsPrint textonly
325 DetailPrint "Installing 'Python for Win32 Extensions'..."
326 SetDetailsPrint listonly
327 ExecWait '"$R2"'
328
329 FunctionEnd
330
331
332 ; --------------------------------
333 ; Startup
334 ; --------------------------------
335 Function .onInit
336
337 Call check_python
338 IfErrors 0 python_found
339 SectionSetFlags ${IDX_PYTHON} 1
340 Return
341
342 python_found:
343 SectionSetFlags ${IDX_PYTHON} 0
344 SectionSetText ${IDX_PYTHON} "Python (found version $python_version)"
345 ;Return
346
347
348 Call check_pythonwin
349 IfErrors 0 pythonwin_found
350 SectionSetFlags ${IDX_PYTHONWIN} 1
351 Return
352
353 pythonwin_found:
354 SectionSetFlags ${IDX_PYTHONWIN} 0
355 SectionSetText ${IDX_PYTHONWIN} "Python for Win32 Extensions (found)"
356 ;Return
357
358 FunctionEnd

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed