/[cvs]/joko/ToolBox/Windows/VpnDial-installer/vpn.nsi
ViewVC logotype

Contents of /joko/ToolBox/Windows/VpnDial-installer/vpn.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Nov 21 19:55:43 2005 UTC (18 years, 7 months ago) by joko
Branch: MAIN
Changes since 1.1: +51 -17 lines
- no detail descriptions
+ added icon
+ modern ui
+ prevent execution if already running

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 "MUI.nsh"
9 !include "parameter.nsi"
10 !include "file_functions.nsi"
11
12
13 ; --------------------------------
14 ; The name of the installer
15 ; --------------------------------
16 Name "VpnDial"
17
18 ; The file to write
19 OutFile "VpnDial-Setup.exe"
20
21 ; The default installation directory
22 InstallDir $PROGRAMFILES\NetFragOrg\VpnDial
23
24 ; Registry key to check for directory (so if you install again, it will
25 ; overwrite the old one automatically)
26 InstallDirRegKey HKLM "Software\NSIS_VpnDial" "Install_Dir"
27
28 ; more options: language of the installer & installer style
29 ;LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
30 ;XPStyle on
31
32 SetOverwrite on
33
34
35 ; --------------------------------
36 ; (MUI) Interface Settings
37 ; --------------------------------
38 !define MUI_ABORTWARNING
39 !define MUI_COMPONENTSPAGE_NODESC
40 !define MUI_ICON "key.ico"
41 !define MUI_UNICON "key.ico"
42
43
44 ; --------------------------------
45 ; Pages
46 ; --------------------------------
47 ;Page components
48 ;Page directory
49 ;Page instfiles
50
51 UninstPage uninstConfirm
52 UninstPage instfiles
53
54 ;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
55 !insertmacro MUI_PAGE_COMPONENTS
56 !insertmacro MUI_PAGE_DIRECTORY
57 !insertmacro MUI_PAGE_INSTFILES
58
59 !insertmacro MUI_UNPAGE_CONFIRM
60 !insertmacro MUI_UNPAGE_INSTFILES
61 !insertmacro MUI_LANGUAGE "German"
62
63
64 ; --------------------------------
65 ; .onInit
66 ; --------------------------------
67
68 Function .onInit
69
70 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
71 Pop $R0
72 StrCmp $R0 0 +3
73 MessageBox MB_OK|MB_ICONEXCLAMATION "Die Installation läuft bereits."
74 Abort
75
76 FunctionEnd
77
78
79 ; --------------------------------
80 ; The stuff to install
81 ; --------------------------------
82
83 Section
84 SetShellVarContext all
85 Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
86 Push "[$connectionname]"
87 Call FileSearch
88 Pop $0 #Number of times found throughout
89 Pop $1 #Found at all? yes/no
90 Pop $2 #Number of lines found in
91 StrCmp $1 yes 0 +3
92 MessageBox MB_OK "Die Verbindung $\"$connectionname$\" existiert bereits. Der Eintrag kann leider nicht doppelt angelegt werden."
93 Abort
94 SectionEnd
95
96 Section "VpnDial" IDX_VpnDial
97
98 SetOverwrite on
99
100 SetDetailsPrint both
101 DetailPrint "Installiere VpnDial..."
102
103 ;SectionIn RO
104
105 ; Set output path to the installation directory.
106 SetOutPath $INSTDIR
107
108 ;CreateDirectory $INSTDIR\certs\
109
110 ; Put file there
111 File /r "vpndial\*.*"
112
113 ; Write the installation path into the registry
114 WriteRegStr HKLM Software\NSIS_VpnDial "Install_Dir" "$INSTDIR"
115
116 ; Write the uninstall keys for Windows
117 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "DisplayName" "VpnDial"
118 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "UninstallString" '"$INSTDIR\uninstall.exe"'
119 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoModify" 1
120 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoRepair" 1
121 WriteUninstaller "uninstall.exe"
122
123 SectionEnd
124
125 Section
126 DetailPrint "Installiere VPN-Verbindung..."
127 Push "[##connectionname##]" #-- text to be replaced within the " "
128 Push "[$connectionname]" #-- replace with anything within the " "
129 Push all #-- replace all occurrences
130 Push all #-- replace all occurrences
131 Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in
132 Call AdvReplaceInFile #-- Call the Function
133 SectionEnd
134
135 Section
136 Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " "
137 Push "PhoneNumber=$destination_host" #-- replace with anything within the " "
138 Push all #-- replace all occurrences
139 Push all #-- replace all occurrences
140 Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in
141 Call AdvReplaceInFile #-- Call the Function
142 SectionEnd
143
144 Section
145 SetShellVarContext all
146 Push $INSTDIR\pbk\rasphone.pbk
147 Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
148 Push $INSTDIR\pbk\connection.pbk
149 Call JoinFiles
150 CopyFiles $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk $INSTDIR\pbk\rasphone_orig.pbk
151 CopyFiles $INSTDIR\pbk\rasphone.pbk $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
152 SetShellVarContext current
153 SectionEnd
154
155 Section
156 nsExec::Exec "$INSTDIR\bin\VpnDial.exe --setup $connectionname --user $username --pass $userpass"
157 SectionEnd
158
159 Section
160 nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root"
161 SectionEnd
162
163 Section
164 nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser"
165 SectionEnd
166
167 ; Optional section (can be disabled by the user)
168 Section "Startmenü-Einträge" IDX_STARTMENU
169
170 SetDetailsPrint both
171 DetailPrint "Installiere Startmenü-Einträge und Desktop-Verknüpfungen..."
172
173 CreateDirectory "$SMPROGRAMS\VpnDial"
174 CreateShortCut "$SMPROGRAMS\VpnDial\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
175 CreateShortCut "$SMPROGRAMS\VpnDial\VpnMonitor.lnk" "$INSTDIR\bin\VpnDial.exe" "--gui --up --monitor $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0
176 CreateShortCut "$SMPROGRAMS\VpnDial\VpnDial.lnk" "$INSTDIR\bin\VpnDial.exe" "--dial $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0
177 ;CreateShortCut "$SMPROGRAMS\VpnDial\VpnSetup.lnk" "$INSTDIR\bin\VpnDial.exe" "--setup $connectionname --user $username --pass $userpass" "$INSTDIR\bin\VpnDial.exe" 0
178 CreateShortCut "$SMPROGRAMS\VpnDial\Zertifikate.lnk" "$INSTDIR\certs\" "" "$INSTDIR\certs\" 0
179 CreateShortCut "$SMPROGRAMS\VpnDial\ZertifikatsVerwaltung.lnk" "$INSTDIR\links\IPSec.msc" "" "$INSTDIR\links\IPSec.msc" 0
180 ;CreateShortCut "$SMPROGRAMS\VpnDial\README.lnk" "$INSTDIR\doc\README.txt" "" "$INSTDIR\doc\README.txt" 0
181 ;CreateShortCut "$SMPROGRAMS\VpnDial\README-HTML.lnk" "$INSTDIR\doc\README.htm" "" "$INSTDIR\doc\README.htm" 0
182
183 CopyFiles "$INSTDIR\links\Netzwerkverbindung*" "$SMPROGRAMS\VpnDial\"
184
185 SectionEnd
186
187
188 ; --------------------------------
189 ; Uninstaller
190 ; --------------------------------
191
192 Section "Uninstall" IDX_UNINSTALL
193
194 ; ------------------
195 ; uninstall VpnDial
196 ; ------------------
197
198 ; Remove registry keys
199 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial"
200 DeleteRegKey HKLM SOFTWARE\NSIS_VpnDial
201
202 ;Remove files and uninstaller
203 ;Delete $INSTDIR\makensisw.exe
204 ;Delete $INSTDIR\uninstall.exe
205 ;Delete "$INSTDIR\*.*"
206
207 ; Remove shortcuts, if any
208 Delete "$SMPROGRAMS\VpnDial\*.*"
209
210 ; Remove directories used
211 RMDir /r "$SMPROGRAMS\VpnDial"
212 RMDir /r "$INSTDIR"
213
214 SectionEnd

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed