tor-mingw.nsi.in 7.6 KB

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