r14328@Kushana: nickm | 2007-09-04 20:17:34 -0400
[tor.git] / contrib / tor-mingw.nsi.in
blobd0637caddfe70b84e18c80bf6cc9406a98388b2a
1 ;tor.nsi - A basic win32 installer for Tor
2 ; Originally written by J Doe.
3 ; See LICENSE for licensing information
4 ;-----------------------------------------
6 !include "MUI.nsh"
8 !define VERSION "0.2.0.6-alpha-dev"
9 !define INSTALLER "tor-${VERSION}-win32.exe"
10 !define WEBSITE "http://tor.eff.org/"
12 !define LICENSE "LICENSE"
13 ;BIN is where it expects to find tor.exe, tor-resolve.exe, libcrypto.a and libssl.a
14 !define BIN "..\bin"
16 SetCompressor lzma
17 OutFile ${INSTALLER}
18 InstallDir $PROGRAMFILES\Tor
19 SetOverWrite ifnewer
21 Name "Tor"
22 Caption "Tor ${VERSION} Setup"
23 BrandingText "The Onion Router"
24 CRCCheck on
25 XPStyle on
26 VIProductVersion "${VERSION}"
27 VIAddVersionKey "ProductName" "The Onion Router: Tor"
28 VIAddVersionKey "Comments" "http://tor.eff.org"
29 VIAddVersionKey "LegalTrademarks" "Three line BSD"
30 VIAddVersionKey "LegalCopyright" "©2004-2007, Roger Dingledine, Nick Mathewson"
31 VIAddVersionKey "FileDescription" "Tor is an implementation of Onion Routing. You can read more at http://tor.eff.org/"
32 VIAddVersionKey "FileVersion" "${VERSION}"
34 !define MUI_WELCOMEPAGE_TITLE "Welcome to the Tor ${VERSION} Setup Wizard"
35 !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"
36 !define MUI_ABORTWARNING
37 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
38 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
39 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
40 !define MUI_HEADERIMAGE
41 !define MUI_FINISHPAGE_RUN "$INSTDIR\tor.exe"
42 !define MUI_FINISHPAGE_LINK "Visit the Tor website for the latest updates."
43 !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
45 !insertmacro MUI_PAGE_WELCOME
46 ; There's no point in having a clickthrough license: Our license adds
47 ; certain rights, but doesn't remove them.
48 ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
49 !insertmacro MUI_PAGE_COMPONENTS
50 !insertmacro MUI_PAGE_DIRECTORY
51 !insertmacro MUI_PAGE_INSTFILES
52 !insertmacro MUI_PAGE_FINISH
53 !insertmacro MUI_UNPAGE_WELCOME
54 !insertmacro MUI_UNPAGE_CONFIRM
55 !insertmacro MUI_UNPAGE_INSTFILES
56 !insertmacro MUI_UNPAGE_FINISH
57 !insertmacro MUI_LANGUAGE "English"
59 Var configdir
60 Var configfile
62 ;Sections
63 ;--------
65 Section "Tor" Tor
66 ;Files that have to be installed for tor to run and that the user
67 ;cannot choose not to install
68 SectionIn RO
69 SetOutPath $INSTDIR
70 File "${BIN}\tor.exe"
71 File "${BIN}\tor-resolve.exe"
72 File "${BIN}\tor.ico"
73 WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
75 StrCpy $configfile "torrc"
76 StrCpy $configdir $APPDATA\Tor
77 ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
78 ; ; shfolder.dll) then we put it in the program directory instead.
79 ; StrCmp $APPDATA "" "" +2
80 ; StrCpy $configdir $INSTDIR
81 SetOutPath $configdir
82 ;If there's already a torrc config file, ask if they want to
83 ;overwrite it with the new one.
84 IfFileExists "$configdir\torrc" "" endiftorrc
85 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?" IDNO yesreplace
86 Delete $configdir\torrc
87 Goto endiftorrc
88 yesreplace:
89 StrCpy $configfile "torrc.sample"
90 endiftorrc:
91 File /oname=$configfile "..\src\config\torrc.sample"
92 SectionEnd
94 Section "OpenSSL 0.9.8d" OpenSSL
95 SetOutPath $INSTDIR
96 File "${BIN}\libcrypto.a"
97 File "${BIN}\libssl.a"
98 SectionEnd
100 Section "Documents" Docs
101 SetOutPath "$INSTDIR\Documents"
102 ;File "doc\FAQ"
103 File "..\doc\HACKING"
104 File "..\doc\spec\address-spec.txt"
105 File "..\doc\spec\control-spec.txt"
106 File "..\doc\spec\control-spec-v0.txt"
107 File "..\doc\spec\dir-spec.txt"
108 File "..\doc\spec\dir-spec-v1.txt"
109 File "..\doc\spec\path-spec.txt"
110 File "..\doc\spec\rend-spec.txt"
111 File "..\doc\spec\socks-extensions.txt"
112 File "..\doc\spec\tor-spec.txt"
113 File "..\doc\spec\version-spec.txt"
115 ; WEBSITE-FILES-HERE
117 File "..\doc\tor-resolve.html"
118 File "..\doc\tor-reference.html"
120 File "..\doc\design-paper\tor-design.pdf"
122 File "..\README"
123 File "..\AUTHORS"
124 File "..\ChangeLog"
125 File "..\LICENSE"
126 SectionEnd
128 ;Section "TorButton for FireFox" Torbutton
129 ; SetOutPath $INSTDIR
130 ; File "${BIN}\torbutton-1.0.4-fx+tb.xpi"
132 ; ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" "Path"
133 ; StrCmp $1 "" +2 0 ; if Path is empty or null, then skip to an error, otherwise proceed
134 ; Exec '"$1firefox.exe" -install-global-extension "$INSTDIR\torbutton-1.0.4-fx+tb.xpi"'
135 ; DetailPrint "Torbutton installed"
136 ; Goto +2
137 ; MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system. Not installing Torbutton."
138 ; DetailPrint "Firefox NOT found."
139 ;SectionEnd
141 SubSection /e "Shortcuts" Shortcuts
143 Section "Start Menu" StartMenu
144 SetOutPath $INSTDIR
145 IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
146 RMDir /r "$SMPROGRAMS\Tor"
147 CreateDirectory "$SMPROGRAMS\Tor"
148 CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
149 CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
150 CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
151 CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
152 IfFileExists "$INSTDIR\Documents\*.*" "" endifdocs
153 CreateDirectory "$SMPROGRAMS\Tor\Documents"
154 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Manual.lnk" "$INSTDIR\Documents\tor-reference.html"
155 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents"
156 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
157 endifdocs:
158 SectionEnd
160 Section "Desktop" Desktop
161 SetOutPath $INSTDIR
162 CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
163 SectionEnd
165 Section /o "Run at startup" Startup
166 SetOutPath $INSTDIR
167 CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico" "" SW_SHOWMINIMIZED
168 SectionEnd
170 SubSectionEnd
172 Section "Uninstall"
173 Delete "$DESKTOP\Tor.lnk"
174 Delete "$INSTDIR\libcrypto.a"
175 Delete "$INSTDIR\libssl.a"
176 Delete "$INSTDIR\tor.exe"
177 Delete "$INSTDIR\tor-resolve.exe"
178 Delete "$INSTDIR\Tor Website.url"
179 Delete "$INSTDIR\torrc"
180 Delete "$INSTDIR\torrc.sample"
181 Delete "$INSTDIR\tor.ico"
182 StrCmp $configdir $INSTDIR +2 ""
183 RMDir /r $configdir
184 Delete "$INSTDIR\Uninstall.exe"
185 RMDir /r "$INSTDIR\Documents"
186 RMDir $INSTDIR
187 RMDir /r "$SMPROGRAMS\Tor"
188 RMDir /r "$APPDATA\Tor"
189 Delete "$SMSTARTUP\Tor.lnk"
190 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
191 SectionEnd
193 Section -End
194 WriteUninstaller "$INSTDIR\Uninstall.exe"
195 ;The registry entries simply add the Tor uninstaller to the Windows
196 ;uninstall list.
197 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
198 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
199 SectionEnd
201 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
202 !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
203 !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
204 !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
205 !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
206 !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
207 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
208 !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
209 !insertmacro MUI_FUNCTION_DESCRIPTION_END