tor.nsi 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. ;tor.nsi - A basic win32 installer for Tor
  2. ; Originally written by J Doe.
  3. ; See LICENSE for licencing information
  4. ;-----------------------------------------
  5. ;
  6. ; How to make an installer:
  7. ; Step 0. If you are a Tor maintainer, make sure that tor.nsi and
  8. ; src/win32/orconfig.h all have the correct version number.
  9. ; Step 1. Download and install OpenSSL. Make sure that the OpenSSL
  10. ; version listed below matches the one you downloaded.
  11. ; Step 2. Download and install NSIS (http://nsis.sourceforge.net)
  12. ; Step 3. Make a directory under the main tor directory called "bin".
  13. ; Step 4. Copy ssleay32.dll and libeay32.dll from OpenSSL into "bin".
  14. ; Step 5. Run man2html on tor.1.in; call the result tor-reference.html
  15. ; Run man2html on tor-resolve.1; call the result tor-resolve.html
  16. ; Step 6. Copy torrc.sample.in to torrc.sample.
  17. ; Step 7. Build tor.exe and tor_resolve.exe; save the result into bin.
  18. ; Step 8. cd into contrib and run "makensis tor.nsi".
  19. ;
  20. ; Problems:
  21. ; - Copying torrc.sample.in to torrc.sample and tor.1.in (implicitly)
  22. ; to tor.1 is a Bad Thing, and leaves us with @autoconf@ vars in the final
  23. ; result.
  24. ; - Building Tor requires too much windows C clue.
  25. ; - We should have actual makefiles for VC that do the right thing.
  26. ; - I need to learn more NSIS juju to solve these:
  27. ; - There should be a batteries-included installer that comes with
  28. ; privoxy too. (Check privoxy license on this; be sure to include
  29. ; all privoxy documents.)
  30. ; - The filename should probably have a revision number.
  31. !include "MUI.nsh"
  32. !define VERSION "0.1.2.0-alpha-cvs"
  33. !define INSTALLER "tor-${VERSION}-win32.exe"
  34. !define WEBSITE "http://tor.eff.org/"
  35. !define LICENSE "..\LICENSE"
  36. ;BIN is where it expects to find tor.exe, tor_resolve.exe, libeay32.dll and
  37. ; ssleay32.dll
  38. !define BIN "..\bin"
  39. SetCompressor lzma
  40. ;SetCompressor zlib
  41. OutFile ${INSTALLER}
  42. InstallDir $PROGRAMFILES\Tor
  43. SetOverWrite ifnewer
  44. Name "Tor"
  45. Caption "Tor ${VERSION} Setup"
  46. BrandingText "The Onion Router"
  47. CRCCheck on
  48. ;Use upx on the installer header to shrink the size.
  49. !packhdr header.dat "upx --best header.dat"
  50. !define MUI_WELCOMEPAGE_TITLE "Welcome to the Tor ${VERSION} Setup Wizard"
  51. !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"
  52. !define MUI_ABORTWARNING
  53. !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
  54. !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
  55. !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
  56. !define MUI_HEADERIMAGE
  57. !define MUI_FINISHPAGE_RUN "$INSTDIR\tor.exe"
  58. !define MUI_FINISHPAGE_LINK "Visit the Tor website for the latest updates."
  59. !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
  60. !insertmacro MUI_PAGE_WELCOME
  61. ; There's no point in having a clickthrough license: Our license adds
  62. ; certain rights, but doesn't remove them.
  63. ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
  64. !insertmacro MUI_PAGE_COMPONENTS
  65. !insertmacro MUI_PAGE_DIRECTORY
  66. !insertmacro MUI_PAGE_INSTFILES
  67. !insertmacro MUI_PAGE_FINISH
  68. !insertmacro MUI_UNPAGE_WELCOME
  69. !insertmacro MUI_UNPAGE_CONFIRM
  70. !insertmacro MUI_UNPAGE_INSTFILES
  71. !insertmacro MUI_UNPAGE_FINISH
  72. !insertmacro MUI_LANGUAGE "English"
  73. Var configdir
  74. Var configfile
  75. ;Sections
  76. ;--------
  77. Section "Tor" Tor
  78. ;Files that have to be installed for tor to run and that the user
  79. ;cannot choose not to install
  80. SectionIn RO
  81. SetOutPath $INSTDIR
  82. File "${BIN}\tor.exe"
  83. File "${BIN}\tor_resolve.exe"
  84. WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
  85. StrCpy $configfile "torrc"
  86. StrCpy $configdir $APPDATA\Tor
  87. ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
  88. ; ; shfolder.dll) then we put it in the program directory instead.
  89. ; StrCmp $APPDATA "" "" +2
  90. ; StrCpy $configdir $INSTDIR
  91. SetOutPath $configdir
  92. ;If there's already a torrc config file, ask if they want to
  93. ;overwrite it with the new one.
  94. IfFileExists "$configdir\torrc" "" endiftorrc
  95. 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
  96. Delete $configdir\torrc
  97. Goto endiftorrc
  98. yesreplace:
  99. StrCpy $configfile "torrc.sample"
  100. endiftorrc:
  101. File /oname=$configfile "..\src\config\torrc.sample"
  102. SectionEnd
  103. Section "OpenSSL 0.9.8a" OpenSSL
  104. SetOutPath $INSTDIR
  105. File "${BIN}\libeay32.dll"
  106. File "${BIN}\ssleay32.dll"
  107. SectionEnd
  108. Section "Documents" Docs
  109. SetOutPath "$INSTDIR\Documents"
  110. ;File "..\doc\FAQ"
  111. File "..\doc\HACKING"
  112. File "..\doc\control-spec.txt"
  113. File "..\doc\dir-spec.txt"
  114. File "..\doc\rend-spec.txt"
  115. File "..\doc\socks-extensions.txt"
  116. File "..\doc\version-spec.txt"
  117. ;
  118. File "..\doc\stylesheet.css"
  119. File "..\doc\tor-doc-osx.html.en"
  120. File "..\doc\tor-doc-osx.html.it"
  121. File "..\doc\tor-doc-server.html.en"
  122. File "..\doc\tor-doc-server.html.it"
  123. File "..\doc\tor-doc-unix.html.en"
  124. File "..\doc\tor-doc-unix.html.it"
  125. File "..\doc\tor-doc-win32.html.en"
  126. File "..\doc\tor-doc-win32.html.es"
  127. File "..\doc\tor-doc-win32.html.it"
  128. File "..\doc\tor-hidden-service.html.en"
  129. File "..\doc\tor-switchproxy.html.en"
  130. File "..\doc\tor-switchproxy.html.it"
  131. ;
  132. File "..\doc\tor-resolve.html"
  133. File "..\doc\tor-reference.html"
  134. ;
  135. File "..\doc\design-paper\tor-design.pdf"
  136. ;
  137. File "..\README"
  138. File "..\AUTHORS"
  139. File "..\ChangeLog"
  140. File "..\LICENSE"
  141. SectionEnd
  142. 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"
  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-doc.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
  159. Section "Desktop" Desktop
  160. SetOutPath $INSTDIR
  161. CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe"
  162. SectionEnd
  163. Section /o "Run at startup" Startup
  164. SetOutPath $INSTDIR
  165. CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "" 0 SW_SHOWMINIMIZED
  166. SectionEnd
  167. SubSectionEnd
  168. Section "Uninstall"
  169. Delete "$DESKTOP\Tor.lnk"
  170. Delete "$INSTDIR\libeay32.dll"
  171. Delete "$INSTDIR\ssleay32.dll"
  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. StrCmp $configdir $INSTDIR +2 ""
  178. RMDir /r $configdir
  179. Delete "$INSTDIR\Uninstall.exe"
  180. RMDir /r "$INSTDIR\Documents"
  181. RMDir $INSTDIR
  182. RMDir /r "$SMPROGRAMS\Tor"
  183. Delete "$SMSTARTUP\Tor.lnk"
  184. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
  185. SectionEnd
  186. Section -End
  187. WriteUninstaller "$INSTDIR\Uninstall.exe"
  188. ;The registry entries simply add the Tor uninstaller to the Windows
  189. ;uninstall list.
  190. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
  191. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  192. SectionEnd
  193. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  194. !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
  195. !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
  196. !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
  197. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
  198. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
  199. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
  200. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
  201. !insertmacro MUI_FUNCTION_DESCRIPTION_END