tor-mingw.nsi.in 7.8 KB

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