From 61c16daba1e10a560041636358133facf05efa75 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Mon, 5 Dec 2016 16:18:57 -0500 Subject: [PATCH] Delay .net 4.0 install to the end and run it stand alone - Use sc to install openvpnserv2 if .NET 4.0 not found - Download of net installer happens withing the installer, but .NET installation is left to run standalone. - Only .NET 4.0 client profile installed which should be enough to run the service (?) Download slightly smaller and installs a bit faster (?) Signed-off-by: Selva Nair --- windows-nsis/DotNetChecker.nsh | 7 ++----- windows-nsis/openvpn.nsi | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/windows-nsis/DotNetChecker.nsh b/windows-nsis/DotNetChecker.nsh index 4790992e..90f54d3f 100644 --- a/windows-nsis/DotNetChecker.nsh +++ b/windows-nsis/DotNetChecker.nsh @@ -104,12 +104,9 @@ DownloadDotNET${FrameworkVersion}: IDYES NewDotNET${FrameworkVersion} IDNO GiveUpDotNET${FrameworkVersion} ${EndIf} - DetailPrint "Pausing installation while downloaded .NET Framework installer runs." - ExecWait '$TEMP\dotnetfx.exe /q /c:"install /q"' + DetailPrint "Starting downloaded .NET Framework installer as stand alone." + Exec '$TEMP\dotnetfx.exe' - DetailPrint "Completed .NET Framework install/update. Removing .NET Framework installer." - Delete "$TEMP\dotnetfx.exe" - DetailPrint ".NET Framework installer removed." goto NewDotNet${FrameworkVersion} GiveUpDotNET${FrameworkVersion}: diff --git a/windows-nsis/openvpn.nsi b/windows-nsis/openvpn.nsi index 5727e53f..0641c846 100755 --- a/windows-nsis/openvpn.nsi +++ b/windows-nsis/openvpn.nsi @@ -255,15 +255,23 @@ SectionEnd Section /o "${PACKAGE_NAME} Service" SecService - !insertmacro CheckNetFramework 40Full - SetOverwrite on SetOutPath "$INSTDIR\bin" ; Copy openvpnserv2.exe for automatic service File /oname=openvpnserv2.exe "${OPENVPNSERV2_EXECUTABLE}" DetailPrint "Installing OpenVPN Service..." - nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv2.exe" -install' + + DotNetChecker::IsDotNet40ClientInstalled + Pop $0 + ${If} $0 == "false" + ${OrIf} $0 == "f" ; could be either false or f as per dotnetchecker.nsh + DetailPrint "NET 4.0 not found. Using sc.exe to install openvpnservice" + nsExec::ExecToLog '$SYSDIR\sc.exe create OpenVPNService binPath= "$INSTDIR\bin\openvpnserv2.exe" depend= tap0901/dhcp' + ${Else} + DetailPrint "Running openvpnserv2.exe -install" + nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv2.exe" -install' + ${EndIf} Pop $R0 # return value/error/timeout @@ -593,6 +601,10 @@ Section -post ${Else} DetailPrint "WARNING: $\"sc.exe start OpenVPNServiceInteractive$\" failed with return value of $R1" ${EndIf} + ${If} ${SectionIsSelected} ${SecService} + ; if no .NET 4, offer to install it + !insertmacro CheckNetFramework 40Client + ${Endif} SectionEnd