aboutsummaryrefslogtreecommitdiffstats
path: root/config/openvpn-client-export/source/openvpn-postinstall.nsi
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2012-11-05 14:10:36 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2012-11-05 20:33:42 +0100
commit43eb7bc003dd6b9b2725d0c9e6fb37a243bfde29 (patch)
treeaed173bbb4dd85bed7a3512636542a481f9b0ae8 /config/openvpn-client-export/source/openvpn-postinstall.nsi
parenta535a40b5c4dc37ee8b055c4d91c715f31d5720e (diff)
downloadpfsense-packages-43eb7bc003dd6b9b2725d0c9e6fb37a243bfde29.tar.gz
pfsense-packages-43eb7bc003dd6b9b2725d0c9e6fb37a243bfde29.tar.bz2
pfsense-packages-43eb7bc003dd6b9b2725d0c9e6fb37a243bfde29.zip
openvpn-client-export, added option to include OpenVPNManager in windows setup, this solves the issues with Windows7/Vista client machines where elevated permissions are required by running OpenVPN as a service.
Diffstat (limited to 'config/openvpn-client-export/source/openvpn-postinstall.nsi')
-rwxr-xr-xconfig/openvpn-client-export/source/openvpn-postinstall.nsi157
1 files changed, 127 insertions, 30 deletions
diff --git a/config/openvpn-client-export/source/openvpn-postinstall.nsi b/config/openvpn-client-export/source/openvpn-postinstall.nsi
index 4f03783d..fb4356e0 100755
--- a/config/openvpn-client-export/source/openvpn-postinstall.nsi
+++ b/config/openvpn-client-export/source/openvpn-postinstall.nsi
@@ -5,7 +5,10 @@
;--------------------------------
;Include Modern UI
- !include "MUI.nsh"
+Var /GLOBAL mui.FinishPage.Run
+!define MUI_FINISHPAGE_RUN_VARIABLES
+
+ !include "MUI2.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
@@ -19,6 +22,7 @@
ShowInstDetails show
+ !include "dotnet2.nsh"
;--------------------------------
;Include Settings
;--------------------------------
@@ -30,7 +34,25 @@
;Pages
;--------------------------------
+!define WELCOME_TITLE 'Welcome to OpenVPN installer.'
+
+!define WELCOME_TEXT "This wizard will guide you through the installation of the OpenVPN client and configuration.$\r$\n$\r$\n\
+This wil automaticaly install the configuration files needed for your connection. \
+And if needed install the required DotNet2 framework."
+ !define MUI_WELCOMEPAGE_TITLE '${WELCOME_TITLE}'
+ ;!define MUI_WELCOMEPAGE_TITLE_3LINES
+ !define MUI_WELCOMEPAGE_TEXT '${WELCOME_TEXT}'
+ !insertmacro MUI_PAGE_WELCOME
+
!insertmacro MUI_PAGE_INSTFILES
+
+
+ !define MUI_FINISHPAGE_RUN "C:\User\test.lnk"
+ !define MUI_FINISHPAGE_RUN_TEXT "Start OpenVPNManager."
+ !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
+ !define MUI_PAGE_CUSTOMFUNCTION_SHOW finish_show
+ !insertmacro MUI_PAGE_FINISH
+
!insertmacro Locate
!insertmacro GetParameters
!insertmacro GetOptions
@@ -46,55 +68,130 @@
;--------------------------------
Function .onInit
-
+ Var /GLOBAL BINPATH
Var /GLOBAL CONFPATH
- ReadRegStr $CONFPATH HKLM "Software\OpenVPN" "config_dir"
-
+ Var /GLOBAL OpenVPNManager
+
+ IfFileExists ".\OpenVPNManager" InstallOpenVPNManager1 DontInstallOpenVPNManager1
+ InstallOpenVPNManager1:
+ strcpy $OpenVPNManager true
+ !insertmacro CheckForDotNET2
+ Goto OpenVPNManagerDone1
+ DontInstallOpenVPNManager1:
+ strcpy $OpenVPNManager false
+ OpenVPNManagerDone1:
FunctionEnd
Function CopyConfFile
-
CopyFiles $R9 $CONFPATH\$R7
Push $0
-
FunctionEnd
Function ImportConfFile
-
ExecWait "rundll32.exe cryptext.dll,CryptExtAddPFX $R9"
Push $0
+FunctionEnd
+Function CopyOpenVPNManager
+ DetailPrint "Installing OpenVPNManager..."
+ DetailPrint "Installing in: $BINPATH\OpenVPNManager\"
+ CreateDirectory "$BINPATH\OpenVPNManager"
+ CreateDirectory "$BINPATH\OpenVPNManager\config"
+ CopyFiles ".\OpenVPNManager\*.*" "$BINPATH\OpenVPNManager"
+ CreateShortcut "$desktop\OpenVPNManager.lnk" "$BINPATH\OpenVPNManager\OpenVPNManager.exe"
+ Push $0
FunctionEnd
+Function finish_show
+ ${If} $OpenVPNManager != "true"
+ ;If OpenVPNManager is not installed then dont give the option to run it. (hide and uncheck the checkbox)
+ ShowWindow $mui.FinishPage.Run 0
+ ${NSD_Uncheck} $mui.FinishPage.Run
+ ${EndIf}
+FunctionEnd
+
+Function LaunchLink
+ ExecShell "" "$desktop\OpenVPNManager.lnk"
+FunctionEnd
;--------------------------------
;Installer Sections
;--------------------------------
-Section "Imort Configuration" SectionImport
-
- DetailPrint "Installing configuration files ..."
- ${Locate} ".\config" "/L=F /M=*.ovpn" "CopyConfFile"
-
- DetailPrint "Installing certificate and key files ..."
- ${Locate} ".\config" "/L=F /M=*.crt" "CopyConfFile"
- ${Locate} ".\config" "/L=F /M=*.key" "CopyConfFile"
-
- ${GetParameters} $R0
- ${GetOptions} $R0 "/Import" $R1
- IfErrors p12_copy p12_import
-
- p12_copy:
- ${Locate} ".\config" "/L=F /M=*.p12" "CopyConfFile"
- Goto p12_done
-
- p12_import:
- ${Locate} ".\config" "/L=F /M=*.p12" "ImportConfFile"
- Goto p12_done
-
- p12_done:
+Section "Import Configuration" SectionImport
+ ${If} $OpenVPNManager == "true"
+ ; OpenVPNManager needs dotnet2
+ !insertmacro InstallDotNet2
+ ${Endif}
+
+ ClearErrors
+ ReadRegStr $BINPATH HKLM "Software\OpenVPN" ""
+ IfErrors OpenVPNInstall OpenVPNAlreadyInstalled
+ OpenVPNInstall:
+ DetailPrint "Pausing installation while OpenVPN installer runs."
+ ExecWait '".\openvpn-install.exe"' $1
+ ${if} $OpenVPNManager == "true"
+ SetShellVarContext all
+ Delete "$desktop\OpenVPN GUI.lnk"
+ SetShellVarContext current
+ ${Endif}
+ Pop $0
+ OpenVPNAlreadyInstalled:
+
+ ClearErrors
+ ReadRegStr $BINPATH HKLM "Software\OpenVPN" ""
+ IfErrors OpenVPNnotFound OpenVPNok
+ OpenVPNnotFound:
+ Abort "OpenVPN installation not found, installation aborted."
+ OpenVPNok:
+ DetailPrint "Completed OpenVPN installation."
+
+ ${If} $OpenVPNManager == "true"
+ strcpy $OpenVPNManager true
+ StrCpy $CONFPATH "$BINPATH\OpenVPNManager\config"
+ call "CopyOpenVPNManager"
+ ${Else}
+ strcpy $OpenVPNManager false
+ ClearErrors
+ ReadRegStr $CONFPATH HKLM "Software\OpenVPN" "config_dir"
+ IfErrors configNotFound configFound
+ configNotFound:
+ ReadRegStr $CONFPATH HKLM "Software\OpenVPN" ""
+ StrCpy $CONFPATH "$CONFPATH\config"
+ configFound:
+
+ ${Endif}
+
+ DetailPrint "Installing configuration files ..."
+ ${Locate} ".\config" "/L=F /M=*.ovpn" "CopyConfFile"
+
+ DetailPrint "Installing certificate and key files ..."
+ ${Locate} ".\config" "/L=F /M=*.crt" "CopyConfFile"
+ ${Locate} ".\config" "/L=F /M=*.key" "CopyConfFile"
+
+ ${If} $OpenVPNManager == "true"
+ DetailPrint "Registering OpenVPNManager service..."
+ ExecWait '"$BINPATH\OpenVPNManager\OpenVPNManager.exe" /install'
+ DetailPrint "Starting OpenVPNManager service..."
+ SimpleSC::StartService "OpenVPNManager" "" 30
+ Pop $0
+ ${Else}
+ ;DetailPrint "Starting OpenVPN Service..."
+ ;SimpleSC::StartService "OpenVPNService" "" 30
+ ;Pop $0
+ ${Endif}
+
+ ${GetParameters} $R0
+ ${GetOptions} $R0 "/Import" $R1
+ IfErrors p12_copy p12_import
+ p12_copy:
+ ${Locate} ".\config" "/L=F /M=*.p12" "CopyConfFile"
+ Goto p12_done
+ p12_import:
+ ${Locate} ".\config" "/L=F /M=*.p12" "ImportConfFile"
+ Goto p12_done
+ p12_done:
SectionEnd
-
;--------------------------------
;Descriptions
;--------------------------------