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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Mon Nov 21 21:45:29 2005 UTC (19 years ago) by joko
Branch: MAIN
Changes since 1.2: +17 -6 lines
+ initial version of "custom page"

1 joko 1.1 ; VpnDial.nsi
2 joko 1.3 ; $Id: vpn.nsi,v 1.2 2005/11/21 19:55:43 joko Exp $
3 joko 1.1 ;
4     ; This script can install VpnDial,
5     ; has uninstall support and (optionally) installs start menu shortcuts.
6     ;
7    
8 joko 1.2 !include "MUI.nsh"
9     !include "parameter.nsi"
10     !include "file_functions.nsi"
11 joko 1.1
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 joko 1.2 ;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 joko 1.1
43    
44     ; --------------------------------
45     ; Pages
46     ; --------------------------------
47 joko 1.2 ;Page components
48     ;Page directory
49     ;Page instfiles
50 joko 1.1
51     UninstPage uninstConfirm
52     UninstPage instfiles
53    
54 joko 1.2 ;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
55 joko 1.3 !insertmacro MUI_PAGE_WELCOME
56     Page custom Setup
57 joko 1.2 !insertmacro MUI_PAGE_COMPONENTS
58     !insertmacro MUI_PAGE_DIRECTORY
59     !insertmacro MUI_PAGE_INSTFILES
60    
61     !insertmacro MUI_UNPAGE_CONFIRM
62     !insertmacro MUI_UNPAGE_INSTFILES
63     !insertmacro MUI_LANGUAGE "German"
64    
65    
66     ; --------------------------------
67     ; .onInit
68     ; --------------------------------
69    
70     Function .onInit
71    
72 joko 1.3 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
73     Pop $R0
74     StrCmp $R0 0 +3
75     MessageBox MB_OK|MB_ICONEXCLAMATION "Die Installation läuft bereits."
76     Abort
77    
78     !insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings.ini"
79 joko 1.2
80     FunctionEnd
81    
82 joko 1.3 Function Setup
83     ; custom page
84     ; see: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html#customPages
85     ; and: http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html
86     !insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus"
87     !insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings.ini"
88     FunctionEnd
89 joko 1.2
90 joko 1.1 ; --------------------------------
91     ; The stuff to install
92     ; --------------------------------
93    
94     Section
95     SetShellVarContext all
96     Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
97     Push "[$connectionname]"
98     Call FileSearch
99     Pop $0 #Number of times found throughout
100     Pop $1 #Found at all? yes/no
101     Pop $2 #Number of lines found in
102     StrCmp $1 yes 0 +3
103 joko 1.2 MessageBox MB_OK "Die Verbindung $\"$connectionname$\" existiert bereits. Der Eintrag kann leider nicht doppelt angelegt werden."
104 joko 1.1 Abort
105     SectionEnd
106    
107     Section "VpnDial" IDX_VpnDial
108    
109 joko 1.2 SetOverwrite on
110    
111 joko 1.1 SetDetailsPrint both
112     DetailPrint "Installiere VpnDial..."
113    
114     ;SectionIn RO
115    
116     ; Set output path to the installation directory.
117     SetOutPath $INSTDIR
118    
119     ;CreateDirectory $INSTDIR\certs\
120    
121     ; Put file there
122     File /r "vpndial\*.*"
123 joko 1.2
124 joko 1.1 ; Write the installation path into the registry
125     WriteRegStr HKLM Software\NSIS_VpnDial "Install_Dir" "$INSTDIR"
126    
127     ; Write the uninstall keys for Windows
128     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "DisplayName" "VpnDial"
129     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "UninstallString" '"$INSTDIR\uninstall.exe"'
130     WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoModify" 1
131     WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial" "NoRepair" 1
132     WriteUninstaller "uninstall.exe"
133    
134     SectionEnd
135    
136     Section
137     DetailPrint "Installiere VPN-Verbindung..."
138     Push "[##connectionname##]" #-- text to be replaced within the " "
139     Push "[$connectionname]" #-- replace with anything within the " "
140     Push all #-- replace all occurrences
141     Push all #-- replace all occurrences
142     Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in
143     Call AdvReplaceInFile #-- Call the Function
144     SectionEnd
145    
146     Section
147     Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " "
148     Push "PhoneNumber=$destination_host" #-- replace with anything within the " "
149     Push all #-- replace all occurrences
150     Push all #-- replace all occurrences
151     Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in
152     Call AdvReplaceInFile #-- Call the Function
153     SectionEnd
154    
155     Section
156     SetShellVarContext all
157     Push $INSTDIR\pbk\rasphone.pbk
158     Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
159     Push $INSTDIR\pbk\connection.pbk
160     Call JoinFiles
161     CopyFiles $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk $INSTDIR\pbk\rasphone_orig.pbk
162     CopyFiles $INSTDIR\pbk\rasphone.pbk $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk
163     SetShellVarContext current
164     SectionEnd
165    
166     Section
167     nsExec::Exec "$INSTDIR\bin\VpnDial.exe --setup $connectionname --user $username --pass $userpass"
168     SectionEnd
169    
170     Section
171     nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root"
172     SectionEnd
173    
174     Section
175     nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser"
176     SectionEnd
177    
178     ; Optional section (can be disabled by the user)
179 joko 1.2 Section "Startmenü-Einträge" IDX_STARTMENU
180 joko 1.1
181     SetDetailsPrint both
182     DetailPrint "Installiere Startmenü-Einträge und Desktop-Verknüpfungen..."
183    
184     CreateDirectory "$SMPROGRAMS\VpnDial"
185     CreateShortCut "$SMPROGRAMS\VpnDial\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
186     CreateShortCut "$SMPROGRAMS\VpnDial\VpnMonitor.lnk" "$INSTDIR\bin\VpnDial.exe" "--gui --up --monitor $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0
187     CreateShortCut "$SMPROGRAMS\VpnDial\VpnDial.lnk" "$INSTDIR\bin\VpnDial.exe" "--dial $connectionname --net $destination_net" "$INSTDIR\bin\VpnDial.exe" 0
188     ;CreateShortCut "$SMPROGRAMS\VpnDial\VpnSetup.lnk" "$INSTDIR\bin\VpnDial.exe" "--setup $connectionname --user $username --pass $userpass" "$INSTDIR\bin\VpnDial.exe" 0
189     CreateShortCut "$SMPROGRAMS\VpnDial\Zertifikate.lnk" "$INSTDIR\certs\" "" "$INSTDIR\certs\" 0
190     CreateShortCut "$SMPROGRAMS\VpnDial\ZertifikatsVerwaltung.lnk" "$INSTDIR\links\IPSec.msc" "" "$INSTDIR\links\IPSec.msc" 0
191 joko 1.2 ;CreateShortCut "$SMPROGRAMS\VpnDial\README.lnk" "$INSTDIR\doc\README.txt" "" "$INSTDIR\doc\README.txt" 0
192     ;CreateShortCut "$SMPROGRAMS\VpnDial\README-HTML.lnk" "$INSTDIR\doc\README.htm" "" "$INSTDIR\doc\README.htm" 0
193 joko 1.1
194     CopyFiles "$INSTDIR\links\Netzwerkverbindung*" "$SMPROGRAMS\VpnDial\"
195    
196     SectionEnd
197    
198    
199     ; --------------------------------
200     ; Uninstaller
201     ; --------------------------------
202    
203     Section "Uninstall" IDX_UNINSTALL
204    
205     ; ------------------
206     ; uninstall VpnDial
207     ; ------------------
208    
209     ; Remove registry keys
210     DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VpnDial"
211     DeleteRegKey HKLM SOFTWARE\NSIS_VpnDial
212    
213     ;Remove files and uninstaller
214     ;Delete $INSTDIR\makensisw.exe
215     ;Delete $INSTDIR\uninstall.exe
216     ;Delete "$INSTDIR\*.*"
217    
218     ; Remove shortcuts, if any
219     Delete "$SMPROGRAMS\VpnDial\*.*"
220    
221     ; Remove directories used
222     RMDir /r "$SMPROGRAMS\VpnDial"
223     RMDir /r "$INSTDIR"
224    
225     SectionEnd

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