Disable logging to control port connections in buf_shrink_freelists.
[tor/rransom.git] / contrib / tor-mingw.nsi.in
blob6deb8d96a42c6c584edf5cbafc9ecd3c9808f32b
1 ;tor.nsi - A basic win32 installer for Tor
2 ; Originally written by J Doe.
3 ; Modified by Steve Topletz, Andrew Lewman
4 ; See the Tor LICENSE for licensing information
5 ;-----------------------------------------
7 !include "MUI.nsh"
8 !include "LogicLib.nsh"
9 !include "FileFunc.nsh"
10 !insertmacro GetParameters
12 !define VERSION "0.2.1.25"
13 !define INSTALLER "tor-${VERSION}-win32.exe"
14 !define WEBSITE "https://www.torproject.org/"
15 !define LICENSE "LICENSE"
16 !define BIN "..\bin" ;BIN is where it expects to find tor.exe, tor-resolve.exe
19 SetCompressor /SOLID LZMA ;Tighter compression
20 RequestExecutionLevel user ;Updated for Vista compatibility
21 OutFile ${INSTALLER}
22 InstallDir $PROGRAMFILES\Tor
23 SetOverWrite ifnewer
24 Name "Tor"
25 Caption "Tor ${VERSION} Setup"
26 BrandingText "The Onion Router"
27 CRCCheck on
28 XPStyle on
29 VIProductVersion "${VERSION}"
30 VIAddVersionKey "ProductName" "The Onion Router: Tor"
31 VIAddVersionKey "Comments" "${WEBSITE}"
32 VIAddVersionKey "LegalTrademarks" "Three line BSD"
33 VIAddVersionKey "LegalCopyright" "©2004-2008, Roger Dingledine, Nick Mathewson. ©2009 The Tor Project, Inc. "
34 VIAddVersionKey "FileDescription" "Tor is an implementation of Onion Routing. You can read more at ${WEBSITE}"
35 VIAddVersionKey "FileVersion" "${VERSION}"
37 !define MUI_WELCOMEPAGE_TITLE "Welcome to the Tor Setup Wizard"
38 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Tor ${VERSION}.\r\n\r\nIf you have previously installed Tor and it is currently running, please exit Tor first before continuing this installation.\r\n\r\n$_CLICK"
39 !define MUI_ABORTWARNING
40 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
41 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
42 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
43 !define MUI_FINISHPAGE_RUN "$INSTDIR\tor.exe"
44 !define MUI_FINISHPAGE_LINK "Visit the Tor website for the latest updates."
45 !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
47 !insertmacro MUI_PAGE_WELCOME
48 ; There's no point in having a clickthrough license: Our license adds
49 ; certain rights, but doesn't remove them.
50 ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
51 !insertmacro MUI_PAGE_COMPONENTS
52 !insertmacro MUI_PAGE_DIRECTORY
53 !insertmacro MUI_PAGE_INSTFILES
54 !insertmacro MUI_PAGE_FINISH
55 !insertmacro MUI_UNPAGE_WELCOME
56 !insertmacro MUI_UNPAGE_CONFIRM
57 !insertmacro MUI_UNPAGE_INSTFILES
58 !insertmacro MUI_UNPAGE_FINISH
59 !insertmacro MUI_LANGUAGE "English"
61 Var CONFIGDIR
62 Var CONFIGFILE
64 Function .onInit
65 Call ParseCmdLine
66 FunctionEnd
68 ;Sections
69 ;--------
71 Section "Tor" Tor
72 ;Files that have to be installed for tor to run and that the user
73 ;cannot choose not to install
74 SectionIn RO
75 SetOutPath $INSTDIR
76 Call ExtractBinaries
77 Call ExtractIcon
78 WriteINIStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
80 StrCpy $CONFIGFILE "torrc"
81 StrCpy $CONFIGDIR $APPDATA\Tor
82 ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
83 ; ; shfolder.dll) then we put it in the program directory instead.
84 ; StrCmp $APPDATA "" "" +2
85 ; StrCpy $CONFIGDIR $INSTDIR
86 SetOutPath $CONFIGDIR
87 ;If there's already a torrc config file, ask if they want to
88 ;overwrite it with the new one.
89 ${If} ${FileExists} "$CONFIGDIR\torrc"
90 MessageBox MB_ICONQUESTION|MB_YESNO "You already have a Tor config file.$\r$\nDo you want to overwrite it with the default sample config file?" IDYES Yes IDNO No
91 Yes:
92 Delete $CONFIGDIR\torrc
93 Goto Next
94 No:
95 StrCpy $CONFIGFILE "torrc.sample"
96 Next:
97 ${EndIf}
98 File /oname=$CONFIGFILE "..\src\config\torrc.sample"
100 ; the geoip file needs to be included and stuffed into the right directory
101 ; otherwise tor is unhappy
102 SetOutPath $APPDATA\Tor
103 Call ExtractGEOIP
104 SectionEnd
106 Section "Documents" Docs
107 Call ExtractDocuments
108 SectionEnd
110 SubSection /e "Shortcuts" Shortcuts
112 Section "Start Menu" StartMenu
113 SetOutPath $INSTDIR
114 ${If} ${FileExists} "$SMPROGRAMS\Tor\*.*"
115 RMDir /r "$SMPROGRAMS\Tor"
116 ${EndIf}
117 Call CreateTorLinks
118 ${If} ${FileExists} "$INSTDIR\Documents\*.*"
119 Call CreateDocLinks
120 ${EndIf}
121 SectionEnd
123 Section "Desktop" Desktop
124 SetOutPath $INSTDIR
125 CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
126 SectionEnd
128 Section /o "Run at startup" Startup
129 SetOutPath $INSTDIR
130 CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico" "" SW_SHOWMINIMIZED
131 SectionEnd
133 SubSectionEnd
135 Section "Uninstall"
136 Call un.InstallPackage
137 SectionEnd
139 Section -End
140 WriteUninstaller "$INSTDIR\Uninstall.exe"
141 ;The registry entries simply add the Tor uninstaller to the Windows
142 ;uninstall list.
143 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
144 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
145 SectionEnd
147 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
148 !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
149 !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
150 !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
151 !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
152 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
153 !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
154 !insertmacro MUI_FUNCTION_DESCRIPTION_END
156 ;####################Functions#########################
158 Function ExtractBinaries
159 File "${BIN}\tor.exe"
160 File "${BIN}\tor-resolve.exe"
161 FunctionEnd
163 Function ExtractGEOIP
164 File "${BIN}\geoip"
165 FunctionEnd
167 Function ExtractIcon
168 File "${BIN}\tor.ico"
169 FunctionEnd
171 Function ExtractSpecs
172 File "..\doc\HACKING"
173 File "..\doc\spec\address-spec.txt"
174 File "..\doc\spec\bridges-spec.txt"
175 File "..\doc\spec\control-spec.txt"
176 File "..\doc\spec\dir-spec.txt"
177 File "..\doc\spec\path-spec.txt"
178 File "..\doc\spec\rend-spec.txt"
179 File "..\doc\spec\socks-extensions.txt"
180 File "..\doc\spec\tor-spec.txt"
181 File "..\doc\spec\version-spec.txt"
182 FunctionEnd
184 Function ExtractHTML
185 File "..\doc\tor.html"
186 File "..\doc\torify.html"
187 File "..\doc\tor-resolve.html"
188 File "..\doc\tor-gencert.html"
189 FunctionEnd
191 Function ExtractReleaseDocs
192 File "..\README"
193 File "..\ChangeLog"
194 File "..\LICENSE"
195 FunctionEnd
197 Function ExtractDocuments
198 SetOutPath "$INSTDIR\Documents"
199 Call ExtractSpecs
200 Call ExtractHTML
201 Call ExtractReleaseDocs
202 FunctionEnd
204 Function un.InstallFiles
205 Delete "$DESKTOP\Tor.lnk"
206 Delete "$INSTDIR\tor.exe"
207 Delete "$INSTDIR\tor-resolve.exe"
208 Delete "$INSTDIR\Tor Website.url"
209 Delete "$INSTDIR\torrc"
210 Delete "$INSTDIR\torrc.sample"
211 Delete "$INSTDIR\tor.ico"
212 Delete "$SMSTARTUP\Tor.lnk"
213 Delete "$INSTDIR\Uninstall.exe"
214 Delete "$INSTDIR\geoip"
215 FunctionEnd
217 Function un.InstallDirectories
218 ${If} $CONFIGDIR == $INSTDIR
219 RMDir /r $CONFIGDIR
220 ${EndIf}
221 RMDir /r "$INSTDIR\Documents"
222 RMDir $INSTDIR
223 RMDir /r "$SMPROGRAMS\Tor"
224 RMDir /r "$APPDATA\Tor"
225 FunctionEnd
227 Function un.WriteRegistry
228 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
229 FunctionEnd
231 Function un.InstallPackage
232 Call un.InstallFiles
233 Call un.InstallDirectories
234 Call un.WriteRegistry
235 FunctionEnd
237 Function CreateTorLinks
238 CreateDirectory "$SMPROGRAMS\Tor"
239 CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
240 CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$CONFIGDIR\torrc"
241 CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
242 CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
243 FunctionEnd
245 Function CreateDocLinks
246 CreateDirectory "$SMPROGRAMS\Tor\Documents"
247 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents"
248 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
249 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Address Specification.lnk" "$INSTDIR\Documents\address-spec.txt"
250 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Bridges Specification.lnk" "$INSTDIR\Documents\bridges-spec.txt"
251 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Control Specification.lnk" "$INSTDIR\Documents\control-spec.txt"
252 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Directory Specification.lnk" "$INSTDIR\Documents\dir-spec.txt"
253 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Path Specification.lnk" "$INSTDIR\Documents\path-spec.txt"
254 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Rend Specification.lnk" "$INSTDIR\Documents\rend-spec.txt"
255 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Version Specification.lnk" "$INSTDIR\Documents\version-spec.txt"
256 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor SOCKS Extensions.lnk" "$INSTDIR\Documents\socks-extensions.txt"
257 FunctionEnd
259 Function ParseCmdLine
260 ${GetParameters} $1
261 ${If} $1 == "-x" ;Extract All Files
262 StrCpy $INSTDIR $EXEDIR
263 Call ExtractBinaries
264 Call ExtractDocuments
265 Quit
266 ${ElseIf} $1 == "-b" ;Extract Binaries Only
267 StrCpy $INSTDIR $EXEDIR
268 Call ExtractBinaries
269 Quit
270 ${ElseIf} $1 != ""
271 MessageBox MB_OK|MB_TOPMOST `${Installer} [-x|-b]$\r$\n$\r$\n -x Extract all files$\r$\n -b Extract binary files only`
272 Quit
273 ${EndIf}
274 FunctionEnd