[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

[Openvpn-users] Some contribution to NSI script (not GUI only)


  • Subject: [Openvpn-users] Some contribution to NSI script (not GUI only)
  • From: Vlada Macek <tuttle@xxxxxxxxxxxxxxxx>
  • Date: Fri, 19 Nov 2004 14:13:46 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Mathias Sundman wrote:

>> Sidenote: I've just made a huge number of custom changes to the
>> Mathias's NSI script. I hope it is stable enough to not force me
>> to care about it in next few months. :-)
>
> Any changes useful for the public worth documenting in the howto?

Aside from many changes not interesting for others, I still think I
have something that may be called a contribution. Maybe James can stay
for one beer here too.

1) BTW, I found that James creates `log' directory only when OpenVPN
Service is installed (which is not my case). But I still find this
directory useful, so I moved its CreateDirectory directive to other
place where it is always executed. I also try to RMDir it (may be
empty) while uninstalling.

2) I like colorful icons. :-) Installer and uninstaller ones:

    !define MUI_ICON "${HOME}\install-win32\openvpn.ico"
    !define MUI_UNICON "${HOME}\install-win32\openvpn.ico"

3) Added near the end of Section -post. This makes Add/remove Programs
a little richer. Package version can also be determined there if needed.

        WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
"DisplayIcon" "$INSTDIR\openvpn.ico"
        WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
"DisplayVersion" "${MUI_VERSION}"

4) Added to both MUI_TEXT_WELCOME_INFO_TEXT  &  MUI_UNINNERTEXT_INTRO:
    "Note: Installation (as well as uninstallation) will not destroy
your keys and certificates appearing in the install folder."

5) In function .onInit:

   Push $R0
     ReadRegStr $R0 HKLM SOFTWARE\OpenVPN-GUI ""
     StrCmp $R0 "" goon
 
     Messagebox MB_YESNO "It seems the package ${MUI_PRODUCT} (OpenVPN
GUI) is already installed.$\r$\nWe recommend you to uninstall it in
the standard way before proceeding. Continue installing?" IDYES goon
 
     Abort
 
     goon:
   Pop $R0

6) Added one callback (custom, not for general use). User is warned on
the final screen, that company VPN-Intro document will be shown and
the GUI run. Last directive relocates My Certificase Wizard; for its
MYCERT.INI directive "[openvpn] template" I use the following value:
..\config\template_ovpn.txt. Seems sufficient.

  Function .onInstSuccess
    ExecShell open "$INSTDIR\MY_OWN_HELP.HTML" SW_SHOWMAXIMIZED
    ExecShell open "$INSTDIR\bin\openvpn-gui.exe"

    WriteINIStr "$INSTDIR\bin\mycert.ini" "paths" "dir"
"${SERV_CONFIG_DIR}"
  FunctionEnd

7) In function un.onInit:

  Push $R0
  Push $R1
    FindWindow $R0 "openvpn-gui"
    IntCmp $R0 0 donerun

    Messagebox MB_YESNO|MB_ICONEXCLAMATION "I'm afraid the program
${MUI_PRODUCT} (OpenVPN GUI) is currently running.$\r$\nUntil you
terminate it, all files that belong to it cannot be
removed.$\r$\nShall this program be killed now? If true, all existing
connections will be closed." IDNO donerun

    SendMessage $R0 ${WM_CLOSE} 0 0 $R1 /TIMEOUT=500
    IntCmp $R1 0 donerun

    Messagebox MB_OK|MB_ICONEXCLAMATION "Trouble terminating
${MUI_PRODUCT} (OpenVPN GUI), please close it and then click OK."

    donerun:
  Pop $R1
  Pop $R0

8) I also hide the (un)install detail printing (user can still display
it with a click). I think most of the home users are not interested in
confusing things. :-)

Note for Mathias: It seems to me that OpenVPN GUI does not react to
"standard" Windows message WM_CLOSE (and possibly others) in the
proper way. Upon receiving it just exits. I humbly think that asking
about closing the existing connections would be more appropriate. Just
like it does when Exit is selected from the tray menu. Then
Uninstaller could send WM_CLOSE (as above) without fear and GUI can
handle it. (If I'm misconcepting something, please correct me, I'm not
Windows insider.

- --

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBnfGJ11BCQx8FlCQRArYSAJ9eE+Pd9xaELmTgyzuog4rSnPflJACdEoto
kX0UYoyh0bemWPtCAmf3tXY=
=SfQA
-----END PGP SIGNATURE-----


____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users