12
12
!include "setpath.nsi"
14
!define MASTER "z:\openvpn"
14
!define MASTER "y:\openvpn\20\openvpn"
15
16
!define HOME "c:\src\openvpn"
16
17
!define BIN "${HOME}\bin"
18
19
!define MUI_PRODUCT "OpenVPN"
19
!define MUI_VERSION "1.6.0" # AUTO_VERSION
20
!define MUI_VERSION "2.0_rc6" # AUTO_VERSION
23
!define TAPDRV "${TAP}.sys"
21
25
; something like "-DBG2"
22
26
!define OUTFILE_LABEL ""
53
57
!define SOURCE_ZIP_DEST "openvpn-${MUI_VERSION}.zip"
54
58
!define SOURCE_ZIP_SRC "${MASTER}\${SOURCE_ZIP_DEST}"
61
#!define SOURCE_ZIP_SRC "c:\src\openvpn\install-win32\null.zip"
56
63
;--------------------------------
57
64
;Modern UI Configuration
163
;------------------------------------------
164
;Set reboot flag based on tapinstall return
167
IntCmp $R0 1 "" noreboot noreboot
170
DetailPrint "REBOOT flag set"
156
174
;--------------------------------
157
175
;Installer Sections
232
250
SetOutPath "$INSTDIR\bin"
233
File "${BIN}\ti2600.1106\tapinstall.exe"
251
File "${BIN}\ti3790\tapinstall.exe"
235
253
FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
236
254
FileWrite $R0 "rem Add a new TAP-Win32 virtual ethernet adapter$\r$\n"
237
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" TAP$\r$\n'
255
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
238
256
FileWrite $R0 "pause$\r$\n"
241
259
FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
242
260
FileWrite $R0 "echo WARNING: this script will delete ALL TAP-Win32 virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
243
261
FileWrite $R0 "pause$\r$\n"
244
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove TAP$\r$\n'
262
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
245
263
FileWrite $R0 "pause$\r$\n"
248
266
SetOutPath "$INSTDIR\driver"
249
267
File "${HOME}\tap-win32\i386\OemWin2k.inf"
250
File "${HOME}\tap-win32\i386\tapdrvr.sys"
268
File "${HOME}\tap-win32\i386\${TAPDRV}"
301
319
; If tapinstall error occurred, $5 will
304
nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids TAP'
322
nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
305
323
Pop $R0 # return value/error/timeout
306
324
IntOp $5 $5 | $R0
307
325
DetailPrint "tapinstall hwids returned: $R0"
309
; If tapinstall output string contains "TAP" we assume
327
; If tapinstall output string contains "${TAP}" we assume
310
328
; that TAP device has been previously installed,
311
329
; therefore we will update, not install.
316
IntCmp $5 0 +1 tapinstall_check_error tapinstall_check_error
334
IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
317
335
IntCmp $R0 -1 tapinstall
320
338
DetailPrint "TAP-Win32 UPDATE"
321
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" TAP'
339
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
322
340
Pop $R0 # return value/error/timeout
323
342
IntOp $5 $5 | $R0
324
343
DetailPrint "tapinstall update returned: $R0"
325
344
Goto tapinstall_check_error
328
DetailPrint "TAP-Win32 INSTALL"
329
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" TAP'
330
Pop $R0 # return value/error/timeout
347
DetailPrint "TAP-Win32 REMOVE OLD TAP"
348
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP'
349
Pop $R0 # return value/error/timeout
350
DetailPrint "tapinstall remove TAP returned: $R0"
351
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAPDEV'
352
Pop $R0 # return value/error/timeout
353
DetailPrint "tapinstall remove TAPDEV returned: $R0"
355
DetailPrint "TAP-Win32 INSTALL (${TAP})"
356
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
357
Pop $R0 # return value/error/timeout
331
359
IntOp $5 $5 | $R0
332
360
DetailPrint "tapinstall install returned: $R0"
334
362
tapinstall_check_error:
363
DetailPrint "tapinstall cumulative status: $5"
336
365
MessageBox MB_OK "An error occurred installing the TAP-Win32 device driver."
354
383
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_append" "${SERV_LOG_APPEND}"
356
385
; install openvpnserv as a service
386
DetailPrint "Previous Service REMOVE (if exists)"
387
nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
388
Pop $R0 # return value/error/timeout
357
389
DetailPrint "Service INSTALL"
358
390
nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -install'
359
391
Pop $R0 # return value/error/timeout
416
448
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenVPN" "UninstallString" "$INSTDIR\Uninstall.exe"
418
450
; Advise a reboot
419
Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP-Win32 driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
451
;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP-Win32 driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
466
498
DetailPrint "TAP-Win32 REMOVE"
467
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP'
499
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
468
500
Pop $R0 # return value/error/timeout
469
501
DetailPrint "tapinstall remove returned: $R0"
487
519
Delete "$INSTDIR\log\README.txt"
489
521
Delete "$INSTDIR\driver\OemWin2k.inf"
490
Delete "$INSTDIR\driver\tapdrvr.sys"
522
Delete "$INSTDIR\driver\${TAPDRV}"
492
524
Delete "$INSTDIR\bin\openssl.exe"
507
539
DeleteRegKey HKCU "Software\${MUI_PRODUCT}"
508
540
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenVPN"
510
Messagebox MB_OK "IMPORTANT: If you intend on reinstalling OpenVPN after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
542
;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling OpenVPN after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
512
544
;Display the Finish header
513
545
!insertmacro MUI_UNFINISHHEADER