r11673@catbus: nickm | 2007-02-06 14:40:07 -0500
[tor.git] / contrib / tor-mingw.nsi.in
blobc6c58c2cb534ff37f5e8921d7ee6ac6cc261fc4b
1 ;tor.nsi - A basic win32 installer for Tor
2 ; Originally written by J Doe.
3 ; See LICENSE for licencing information
4 ;-----------------------------------------
6 !include "MUI.nsh"
8 !define VERSION "0.1.2.7-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\control-spec.txt"
105 File "..\doc\dir-spec.txt"
106 File "..\doc\rend-spec.txt"
107 File "..\doc\socks-extensions.txt"
108 File "..\doc\tor-spec.txt"
109 File "..\doc\version-spec.txt"
111 ; WEBSITE-FILES-HERE
113 File "..\doc\tor-resolve.html"
114 File "..\doc\tor-reference.html"
116 File "..\doc\design-paper\tor-design.pdf"
118 File "..\README"
119 File "..\AUTHORS"
120 File "..\ChangeLog"
121 File "..\LICENSE"
122 SectionEnd
124 ;Section "TorButton for FireFox" Torbutton
125 ; SetOutPath $INSTDIR
126 ; File "${BIN}\torbutton-1.0.4-fx+tb.xpi"
128 ; ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" "Path"
129 ; StrCmp $1 "" +2 0 ; if Path is empty or null, then skip to an error, otherwise proceed
130 ; Exec '"$1firefox.exe" -install-global-extension "$INSTDIR\torbutton-1.0.4-fx+tb.xpi"'
131 ; DetailPrint "Torbutton installed"
132 ; Goto +2
133 ; MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system. Not installing Torbutton."
134 ; DetailPrint "Firefox NOT found."
135 ;SectionEnd
137 SubSection /e "Shortcuts" Shortcuts
139 Section "Start Menu" StartMenu
140 SetOutPath $INSTDIR
141 IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
142 RMDir /r "$SMPROGRAMS\Tor"
143 CreateDirectory "$SMPROGRAMS\Tor"
144 CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
145 CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
146 CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
147 CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
148 IfFileExists "$INSTDIR\Documents\*.*" "" endifdocs
149 CreateDirectory "$SMPROGRAMS\Tor\Documents"
150 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Manual.lnk" "$INSTDIR\Documents\tor-reference.html"
151 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents"
152 CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
153 endifdocs:
154 SectionEnd
156 Section "Desktop" Desktop
157 SetOutPath $INSTDIR
158 CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
159 SectionEnd
161 Section /o "Run at startup" Startup
162 SetOutPath $INSTDIR
163 CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico" "" SW_SHOWMINIMIZED
164 SectionEnd
166 SubSectionEnd
168 Section "Uninstall"
169 Delete "$DESKTOP\Tor.lnk"
170 Delete "$INSTDIR\libcrypto.a"
171 Delete "$INSTDIR\libssl.a"
172 Delete "$INSTDIR\tor.exe"
173 Delete "$INSTDIR\tor-resolve.exe"
174 Delete "$INSTDIR\Tor Website.url"
175 Delete "$INSTDIR\torrc"
176 Delete "$INSTDIR\torrc.sample"
177 Delete "$INSTDIR\tor.ico"
178 StrCmp $configdir $INSTDIR +2 ""
179 RMDir /r $configdir
180 Delete "$INSTDIR\Uninstall.exe"
181 RMDir /r "$INSTDIR\Documents"
182 RMDir $INSTDIR
183 RMDir /r "$SMPROGRAMS\Tor"
184 RMDir /r "$APPDATA\Tor"
185 Delete "$SMSTARTUP\Tor.lnk"
186 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
187 SectionEnd
189 Section -End
190 WriteUninstaller "$INSTDIR\Uninstall.exe"
191 ;The registry entries simply add the Tor uninstaller to the Windows
192 ;uninstall list.
193 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
194 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
195 SectionEnd
197 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
198 !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
199 !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
200 !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
201 !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
202 !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
203 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
204 !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
205 !insertmacro MUI_FUNCTION_DESCRIPTION_END