tor-mingw.nsi.in 7.5 KB

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