--- joko/ToolBox/Windows/VpnDial-installer/vpn.nsi 2005/11/21 19:55:43 1.2 +++ joko/ToolBox/Windows/VpnDial-installer/vpn.nsi 2005/11/22 16:26:59 1.7 @@ -1,13 +1,15 @@ ; VpnDial.nsi -; $Id: vpn.nsi,v 1.2 2005/11/21 19:55:43 joko Exp $ +; $Id: vpn.nsi,v 1.7 2005/11/22 16:26:59 joko Exp $ ; ; This script can install VpnDial, ; has uninstall support and (optionally) installs start menu shortcuts. ; !include "MUI.nsh" -!include "parameter.nsi" +!include "variables-declaration.nsi" +!include "string_functions.nsi" !include "file_functions.nsi" +!include "ras_functions.nsi" ; -------------------------------- @@ -25,10 +27,6 @@ ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\NSIS_VpnDial" "Install_Dir" -; more options: language of the installer & installer style -;LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf" -;XPStyle on - SetOverwrite on @@ -44,14 +42,14 @@ ; -------------------------------- ; Pages ; -------------------------------- -;Page components -;Page directory -;Page instfiles UninstPage uninstConfirm UninstPage instfiles -;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" +!insertmacro MUI_PAGE_WELCOME +Page custom SetupPage1 +Page custom SetupPage2 +Page custom SetupPage3 !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES @@ -66,13 +64,34 @@ ; -------------------------------- Function .onInit + + System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' + Pop $R0 + StrCmp $R0 0 +3 + MessageBox MB_OK|MB_ICONEXCLAMATION "Die Installation läuft bereits." + Abort + + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings.ini" + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings_net.ini" + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings_cert.ini" +FunctionEnd -System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' -Pop $R0 -StrCmp $R0 0 +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "Die Installation läuft bereits." - Abort +Function SetupPage1 + ; custom page + ; see: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html#customPages + ; and: http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html + !insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings.ini" +FunctionEnd +Function SetupPage2 + !insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings_net.ini" +FunctionEnd + +Function SetupPage3 + !insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings_cert.ini" FunctionEnd @@ -81,6 +100,55 @@ ; -------------------------------- Section + + ;Get Parameter from vpndial_settings.ini + + ;Get Connectionname + !insertmacro MUI_INSTALLOPTIONS_READ $connectionname "vpndial_settings.ini" "Field 2" "State" + ;MessageBox MB_OK $R1 + ;StrCpy $connectionname $R1 + + ;Get Destination_host + !insertmacro MUI_INSTALLOPTIONS_READ $destination_host "vpndial_settings.ini" "Field 3" "State" + ;MessageBox MB_OK $R2 + ;StrCpy $destination_host $R2 + + ;Get Username + !insertmacro MUI_INSTALLOPTIONS_READ $username "vpndial_settings.ini" "Field 4" "State" + + ;Get Password + !insertmacro MUI_INSTALLOPTIONS_READ $userpass "vpndial_settings.ini" "Field 8" "State" + + ;------------------------------------------------------------------------------------------------------------- + + ;Get Parameter from vpndial_settings_net.ini + + ;Get Destination_net + !insertmacro MUI_INSTALLOPTIONS_READ $R1 "vpndial_settings_net.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R2 "vpndial_settings_net.ini" "Field 3" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R3 "vpndial_settings_net.ini" "Field 4" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R4 "vpndial_settings_net.ini" "Field 7" "State" + + StrCpy $destination_net "$R1.$R2.$R3.$R4" + + ;Get Destination_mask + !insertmacro MUI_INSTALLOPTIONS_READ $R5 "vpndial_settings_net.ini" "Field 12" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R6 "vpndial_settings_net.ini" "Field 13" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R7 "vpndial_settings_net.ini" "Field 14" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $R8 "vpndial_settings_net.ini" "Field 15" "State" + + StrCpy $destination_mask "$R12.$R13.$R14.$R15" + + ;-------------------------------------------------------------------------------------------------------------- + + ;Get Parameter from vpndial_settings_cert.ini + + !insertmacro MUI_INSTALLOPTIONS_READ $cacert "vpndial_settings_cert.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $usercert "vpndial_settings_cert.ini" "Field 3" "State" + +SectionEnd + +Section SetShellVarContext all Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk Push "[$connectionname]" @@ -121,7 +189,13 @@ WriteUninstaller "uninstall.exe" SectionEnd - + + +; --------------------------------------------------------------------------- +; pbk-Datei anpassen +; --------------------------------------------------------------------------- + +; Verbindungsname Section DetailPrint "Installiere VPN-Verbindung..." Push "[##connectionname##]" #-- text to be replaced within the " " @@ -132,6 +206,7 @@ Call AdvReplaceInFile #-- Call the Function SectionEnd +; Gegenstelle Section Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " " Push "PhoneNumber=$destination_host" #-- replace with anything within the " " @@ -140,7 +215,20 @@ Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in Call AdvReplaceInFile #-- Call the Function SectionEnd - + +; GUID +Section + Call CreateRasGUID + Pop $0 ; contains GUID + Push "Guid=##guid##" #-- text to be replaced within the " " + Push "Guid=$0" #-- replace with anything within the " " + Push all #-- replace all occurrences + Push all #-- replace all occurrences + Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in + Call AdvReplaceInFile #-- Call the Function +SectionEnd + +; Verbindungsdatei mit globaler Datei zusammenführen Section SetShellVarContext all Push $INSTDIR\pbk\rasphone.pbk @@ -157,11 +245,13 @@ SectionEnd Section -nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root" +;nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root" +;nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $cacert -s -r localMachine root" SectionEnd Section -nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser" +;nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser" +nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $usercert -c LOCAL_MACHINE\My -a $currentuser" SectionEnd ; Optional section (can be disabled by the user)