tor.nsi 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.
  10. ; Step 2. Download and install NSIS (http://nsis.sourceforge.net)
  11. ; Step 3. Make a directory under the main tor directory called "bin".
  12. ; Step 4. Copy ssleay32.dll and libeay32.dll from OpenSSL into "bin".
  13. ; Step 5. Run man2html on tor.1.in; call the result tor-reference.html
  14. ; Run man2html on tor-resolve.1; call the result tor-resolve.html
  15. ; Step 6. Copy torrc.sample.in to torrc.sample.
  16. ; Step 7. Build tor.exe; save the result into bin.
  17. ; Step 8. cd into contrib and run "makensis tor.nsi".
  18. ;
  19. ; Problems:
  20. ; - Copying torrc.sample.in to torrc.sample and tor.1.in (implicitly)
  21. ; to tor.1 is a Bad Thing, and leaves us with @autoconf@ vars in the final
  22. ; result.
  23. ; - Building Tor requires too much windows C clue.
  24. ; - We should have actual makefiles for VC that do the right thing.
  25. ; - We should maybe have project files for VCfoo too.
  26. ; - It would be nice if version numbers checked themselves.
  27. ; - I need to learn more NSIS juju to solve these:
  28. ; - tor-resolve.exe isn't included in the installer.
  29. ; - There should be a batteries-included installer that comes with
  30. ; privoxy too. (Check privoxy license on this; be sure to include
  31. ; all privoxy documents.)
  32. ; - The filename should probably have a revision number.
  33. !include "MUI.nsh"
  34. !define VERSION "0.0.9pre6-cvs"
  35. !define INSTALLER "tor-${VERSION}-win32.exe"
  36. !define WEBSITE "http://freehaven.net/tor/"
  37. !define LICENSE "..\LICENSE"
  38. ;BIN is where it expects to find tor.exe, libeay32.dll, 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. !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
  63. !insertmacro MUI_PAGE_COMPONENTS
  64. !insertmacro MUI_PAGE_DIRECTORY
  65. !insertmacro MUI_PAGE_INSTFILES
  66. !insertmacro MUI_PAGE_FINISH
  67. !insertmacro MUI_UNPAGE_WELCOME
  68. !insertmacro MUI_UNPAGE_CONFIRM
  69. !insertmacro MUI_UNPAGE_INSTFILES
  70. !insertmacro MUI_UNPAGE_FINISH
  71. !insertmacro MUI_LANGUAGE "English"
  72. Var configdir
  73. Var configfile
  74. ;Sections
  75. ;--------
  76. Section "Tor" Tor
  77. ;Files that have to be installed for tor to run and that the user
  78. ;cannot choose not to install
  79. SectionIn RO
  80. SetOutPath $INSTDIR
  81. File "${BIN}\tor.exe"
  82. WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
  83. StrCpy $configfile "torrc"
  84. StrCpy $configdir $APPDATA\Tor
  85. ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
  86. ; ; shfolder.dll) then we put it in the program directory instead.
  87. ; StrCmp $APPDATA "" "" +2
  88. ; StrCpy $configdir $INSTDIR
  89. SetOutPath $configdir
  90. ;If there's already a torrc config file, ask if they want to
  91. ;overwrite it with the new one.
  92. IfFileExists "$configdir\torrc" "" +5
  93. 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 +3
  94. Delete $configdir\torrc
  95. Goto +2
  96. StrCpy $configfile "torrc.sample"
  97. File /oname=$configfile "..\src\config\torrc.sample"
  98. SectionEnd
  99. Section "OpenSSL 0.9.7d" OpenSSL
  100. SetOutPath $INSTDIR
  101. File "${BIN}\libeay32.dll"
  102. File "${BIN}\ssleay32.dll"
  103. SectionEnd
  104. Section "Documents" Docs
  105. SetOutPath "$INSTDIR\Documents"
  106. File "..\doc\CLIENTS"
  107. File "..\doc\tor-spec.txt"
  108. File "..\doc\FAQ"
  109. File "..\doc\HACKING"
  110. File "..\doc\rend-spec.txt"
  111. File "..\doc\control-spec.txt"
  112. File "..\doc\tor-doc.html"
  113. File "..\doc\tor-doc.css"
  114. File "..\doc\tor-resolve.html"
  115. File "..\doc\tor-reference.html"
  116. File "..\doc\design-paper\tor-design.pdf"
  117. File "..\README"
  118. File "..\AUTHORS"
  119. File "..\ChangeLog"
  120. SectionEnd
  121. SubSection /e "Shortcuts" Shortcuts
  122. Section "Start Menu" StartMenu
  123. SetOutPath $INSTDIR
  124. IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
  125. RMDir /r "$SMPROGRAMS\Tor"
  126. CreateDirectory "$SMPROGRAMS\Tor"
  127. CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe"
  128. CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
  129. CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
  130. CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  131. IfFileExists "$INSTDIR\Documents\*.*" "" +4
  132. CreateDirectory "$SMPROGRAMS\Tor\Documents"
  133. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents\tor-doc.html"
  134. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
  135. SectionEnd
  136. Section "Desktop" Desktop
  137. SetOutPath $INSTDIR
  138. CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe"
  139. SectionEnd
  140. Section /o "Run at startup" Startup
  141. SetOutPath $INSTDIR
  142. CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "" 0 SW_SHOWMINIMIZED
  143. SectionEnd
  144. SubSectionEnd
  145. Section "Uninstall"
  146. Delete "$DESKTOP\Tor.lnk"
  147. Delete "$INSTDIR\libeay32.dll"
  148. Delete "$INSTDIR\ssleay32.dll"
  149. Delete "$INSTDIR\tor.exe"
  150. Delete "$INSTDIR\Tor Website.url"
  151. Delete "$INSTDIR\torrc"
  152. Delete "$INSTDIR\torrc.sample"
  153. StrCmp $configdir $INSTDIR +2 ""
  154. RMDir /r $configdir
  155. Delete "$INSTDIR\Uninstall.exe"
  156. RMDir /r "$INSTDIR\Documents"
  157. RMDir $INSTDIR
  158. RMDir /r "$SMPROGRAMS\Tor"
  159. Delete "$SMSTARTUP\Tor.lnk"
  160. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
  161. SectionEnd
  162. Section -End
  163. WriteUninstaller "$INSTDIR\Uninstall.exe"
  164. ;The registry entries simply add the Tor uninstaller to the Windows
  165. ;uninstall list.
  166. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
  167. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  168. SectionEnd
  169. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  170. !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
  171. !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
  172. !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
  173. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
  174. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
  175. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
  176. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
  177. !insertmacro MUI_FUNCTION_DESCRIPTION_END