tor.nsi.in 8.1 KB

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