1 |
joko |
1.1 |
; VpnDial.nsi |
2 |
|
|
; $Id: vpn.nsi,v 1.1 2005/11/18 19:06:27 joko Exp $ |
3 |
|
|
; |
4 |
|
|
; This script can install VpnDial, |
5 |
|
|
; has uninstall support and (optionally) installs start menu shortcuts. |
6 |
|
|
; |
7 |
|
|
|
8 |
|
|
!include "connection.nsi" |
9 |
|
|
!include "vpn_functions.nsi" |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
; -------------------------------- |
13 |
|
|
; The name of the installer |
14 |
|
|
; -------------------------------- |
15 |
|
|
Name "VpnDial" |
16 |
|
|
|
17 |
|
|
; The file to write |
18 |
|
|
OutFile "VpnDial-Setup.exe" |
19 |
|
|
|
20 |
|
|
; The default installation directory |
21 |
|
|
InstallDir $PROGRAMFILES\NetFragOrg\VpnDial |
22 |
|
|
|
23 |
|
|
; Registry key to check for directory (so if you install again, it will |
24 |
|
|
; overwrite the old one automatically) |
25 |
|
|
InstallDirRegKey HKLM "Software\NSIS_VpnDial" "Install_Dir" |
26 |
|
|
|
27 |
|
|
; more options: language of the installer & installer style |
28 |
|
|
LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf" |
29 |
|
|
XPStyle on |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
; -------------------------------- |
33 |
|
|
; Pages |
34 |
|
|
; -------------------------------- |
35 |
|
|
|
36 |
|
|
Page components |
37 |
|
|
Page directory |
38 |
|
|
Page instfiles |
39 |
|
|
|
40 |
|
|
UninstPage uninstConfirm |
41 |
|
|
UninstPage instfiles |
42 |
|
|
|
43 |
|
|
; -------------------------------- |
44 |
|
|
; The stuff to install |
45 |
|
|
; -------------------------------- |
46 |
|
|
|
47 |
|
|
Section |
48 |
|
|
SetShellVarContext all |
49 |
|
|
Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk |
50 |
|
|
Push "[$connectionname]" |
51 |
|
|
Call FileSearch |
52 |
|
|
Pop $0 #Number of times found throughout |
53 |
|
|
Pop $1 #Found at all? yes/no |
54 |
|
|
Pop $2 #Number of lines found in |
55 |
|
|
StrCmp $1 yes 0 +3 |
56 |
|
|
MessageBox MB_OK "$\"[$connectionname]$\" was found already found. Cannot create. Sorry." |
57 |
|
|
Abort |
58 |
|
|
SectionEnd |
59 |
|
|
|
60 |
|
|
Section "VpnDial" IDX_VpnDial |
61 |
|
|
|
62 |
|
|
SetDetailsPrint both |
63 |
|
|
DetailPrint "Installiere VpnDial..." |
64 |
|
|
|
65 |
|
|
;SectionIn RO |
66 |
|
|
|
67 |
|
|
; Set output path to the installation directory. |
68 |
|
|
SetOutPath $INSTDIR |
69 |
|
|
|
70 |
|
|
;CreateDirectory $INSTDIR\certs\ |
71 |
|
|
|
72 |
|
|
; Put file there |
73 |
|
|
;File /r "C:\IPSec\nsis\vpndial\*.*" |
74 |
|
|
File /r "vpndial\*.*" |
75 |
|
|
;File "C:\IPSec\nsis\vpndial\certs\" |
76 |
|
|
;File "C:\IPSec\nsis\vpndial\certs\*.*" |
77 |
|
|
|
78 |
|
|
; Write the installation path into the registry |
79 |
|
|
WriteRegStr HKLM Software\NSIS_VpnDial "Install_Dir" "$INSTDIR" |
80 |
|
|
|
81 |
|
|
; Write the uninstall keys for Windows |
82 |
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "DisplayName" "VpnDial" |
83 |
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "UninstallString" '"$INSTDIR\uninstall.exe"' |
84 |
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoModify" 1 |
85 |
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoRepair" 1 |
86 |
|
|
WriteUninstaller "uninstall.exe" |
87 |
|
|
|
88 |
|
|
SectionEnd |
89 |
|
|
|
90 |
|
|
Section |
91 |
|
|
DetailPrint "Installiere VPN-Verbindung..." |
92 |
|
|
Push "[##connectionname##]" #-- text to be replaced within the " " |
93 |
|
|
Push "[$connectionname]" #-- replace with anything within the " " |
94 |
|
|
Push all #-- replace all occurrences |
95 |
|
|
Push all #-- replace all occurrences |
96 |
|
|
Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in |
97 |
|
|
Call AdvReplaceInFile #-- Call the Function |
98 |
|
|
SectionEnd |
99 |
|
|
|
100 |
|
|
Section |
101 |
|
|
Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " " |
102 |
|
|
Push "PhoneNumber=$destination_host" #-- replace with anything within the " " |
103 |
|
|
Push all #-- replace all occurrences |
104 |
|
|
Push all #-- replace all occurrences |
105 |
|
|
Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in |
106 |
|
|
Call AdvReplaceInFile #-- Call the Function |
107 |
|
|
SectionEnd |
108 |
|
|
|
109 |
|
|
Section |
110 |
|
|
SetShellVarContext all |
111 |
|
|
Push $INSTDIR\pbk\rasphone.pbk |
112 |
|
|
Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk |
113 |
|
|
Push $INSTDIR\pbk\connection.pbk |
114 |
|
|
Call JoinFiles |
115 |
|
|
CopyFiles $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk $INSTDIR\pbk\rasphone_orig.pbk |
116 |
|
|
CopyFiles $INSTDIR\pbk\rasphone.pbk $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk |
117 |
|
|
SetShellVarContext current |
118 |
|
|
SectionEnd |
119 |
|
|
|
120 |
|
|
Section |
121 |
|
|
nsExec::Exec "$INSTDIR\bin\VpnDial.exe --setup $connectionname --user $username --pass $userpass" |
122 |
|
|
SectionEnd |
123 |
|
|
|
124 |
|
|
Section |
125 |
|
|
nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root" |
126 |
|
|
SectionEnd |
127 |
|
|
|
128 |
|
|
Section |
129 |
|
|
nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser" |
130 |
|
|
SectionEnd |
131 |
|
|
|
132 |
|
|
; Optional section (can be disabled by the user) |
133 |
|
|
Section "Start Menu Shortcuts" IDX_STARTMENU |
134 |
|
|
|
135 |
|
|
SetDetailsPrint both |
136 |
|
|
DetailPrint "Installiere Startmenü-Einträge und Desktop-Verknüpfungen..." |
137 |
|
|
|
138 |
|
|
CreateDirectory "$SMPROGRAMS\VpnDial" |
139 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
140 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\VpnMonitor.lnk" "$INSTDIR\bin\VpnDial.exe" "--gui --up --monitor $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0 |
141 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\VpnDial.lnk" "$INSTDIR\bin\VpnDial.exe" "--dial $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0 |
142 |
|
|
;CreateShortCut "$SMPROGRAMS\VpnDial\VpnSetup.lnk" "$INSTDIR\bin\VpnDial.exe" "--setup $connectionname --user $username --pass $userpass" "$INSTDIR\bin\VpnDial.exe" 0 |
143 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\Zertifikate.lnk" "$INSTDIR\certs\" "" "$INSTDIR\certs\" 0 |
144 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\ZertifikatsVerwaltung.lnk" "$INSTDIR\links\IPSec.msc" "" "$INSTDIR\links\IPSec.msc" 0 |
145 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\README.lnk" "$INSTDIR\doc\README.txt" "" "$INSTDIR\doc\README.txt" 0 |
146 |
|
|
CreateShortCut "$SMPROGRAMS\VpnDial\README-HTML.lnk" "$INSTDIR\doc\README.htm" "" "$INSTDIR\doc\README.htm" 0 |
147 |
|
|
|
148 |
|
|
CopyFiles "$INSTDIR\links\Netzwerkverbindung*" "$SMPROGRAMS\VpnDial\" |
149 |
|
|
|
150 |
|
|
SectionEnd |
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
; -------------------------------- |
155 |
|
|
; Uninstaller |
156 |
|
|
; -------------------------------- |
157 |
|
|
|
158 |
|
|
Section "Uninstall" IDX_UNINSTALL |
159 |
|
|
|
160 |
|
|
; ------------------ |
161 |
|
|
; uninstall VpnDial |
162 |
|
|
; ------------------ |
163 |
|
|
|
164 |
|
|
; Remove registry keys |
165 |
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" |
166 |
|
|
DeleteRegKey HKLM SOFTWARE\NSIS_VpnDial |
167 |
|
|
|
168 |
|
|
;Remove files and uninstaller |
169 |
|
|
;Delete $INSTDIR\makensisw.exe |
170 |
|
|
;Delete $INSTDIR\uninstall.exe |
171 |
|
|
;Delete "$INSTDIR\*.*" |
172 |
|
|
|
173 |
|
|
; Remove shortcuts, if any |
174 |
|
|
Delete "$SMPROGRAMS\VpnDial\*.*" |
175 |
|
|
|
176 |
|
|
; Remove directories used |
177 |
|
|
RMDir /r "$SMPROGRAMS\VpnDial" |
178 |
|
|
RMDir /r "$INSTDIR" |
179 |
|
|
|
180 |
|
|
SectionEnd |