tor.nsi 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. ;tor.nsi - A basic win32 installer for Tor
  2. ; Originally written by J Doe.
  3. ; See LICENSE for licencing information
  4. ;-----------------------------------------
  5. ;
  6. ;NSIS will be needed to create an installer from this script:
  7. ;http://nsis.sourceforge.net/
  8. !include "MUI.nsh"
  9. !define VERSION "0.0.9pre6-cvs"
  10. !define INSTALLER "tor-${VERSION}-win32.exe"
  11. !define WEBSITE "http://freehaven.net/tor/"
  12. !define LICENSE "..\LICENSE"
  13. ;BIN is where it expects to find tor.exe, libeay32.dll, ssleay32.dll
  14. !define BIN "..\bin"
  15. SetCompressor lzma
  16. ;SetCompressor zlib
  17. OutFile ${INSTALLER}
  18. InstallDir $PROGRAMFILES\Tor
  19. SetOverWrite ifnewer
  20. Name "Tor"
  21. Caption "Tor ${VERSION} Setup"
  22. BrandingText "The Onion Router"
  23. CRCCheck on
  24. ;Use upx on the installer header to shrink the size.
  25. !packhdr header.dat "upx --best header.dat"
  26. !define MUI_WELCOMEPAGE_TITLE "Welcome to the Tor ${VERSION} Setup Wizard"
  27. !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"
  28. !define MUI_ABORTWARNING
  29. !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
  30. !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
  31. !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
  32. !define MUI_HEADERIMAGE
  33. !define MUI_FINISHPAGE_RUN "$INSTDIR\tor.exe"
  34. !define MUI_FINISHPAGE_LINK "Visit the Tor website for the latest updates."
  35. !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
  36. !insertmacro MUI_PAGE_WELCOME
  37. !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
  38. !insertmacro MUI_PAGE_COMPONENTS
  39. !insertmacro MUI_PAGE_DIRECTORY
  40. !insertmacro MUI_PAGE_INSTFILES
  41. !insertmacro MUI_PAGE_FINISH
  42. !insertmacro MUI_UNPAGE_WELCOME
  43. !insertmacro MUI_UNPAGE_CONFIRM
  44. !insertmacro MUI_UNPAGE_INSTFILES
  45. !insertmacro MUI_UNPAGE_FINISH
  46. !insertmacro MUI_LANGUAGE "English"
  47. Var configdir
  48. Var configfile
  49. ;Sections
  50. ;--------
  51. Section "Tor" Tor
  52. ;Files that have to be installed for tor to run and that the user
  53. ;cannot choose not to install
  54. SectionIn RO
  55. SetOutPath $INSTDIR
  56. File "${BIN}\tor.exe"
  57. WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
  58. StrCpy $configfile "torrc"
  59. StrCpy $configdir $APPDATA\Tor
  60. ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
  61. ; ; shfolder.dll) then we put it in the program directory instead.
  62. ; StrCmp $APPDATA "" "" +2
  63. ; StrCpy $configdir $INSTDIR
  64. SetOutPath $configdir
  65. ;If there's already a torrc config file, ask if they want to
  66. ;overwrite it with the new one.
  67. IfFileExists "$configdir\torrc" "" +5
  68. 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
  69. Delete $configdir\torrc
  70. Goto +2
  71. StrCpy $configfile "torrc.sample"
  72. File /oname=$configfile "..\..\src\config\torrc.sample"
  73. SectionEnd
  74. Section "OpenSSL 0.9.7d" OpenSSL
  75. SetOutPath $INSTDIR
  76. File "${BIN}\libeay32.dll"
  77. File "${BIN}\ssleay32.dll"
  78. SectionEnd
  79. Section "Documents" Docs
  80. SetOutPath "$INSTDIR\Documents"
  81. File "..\doc\CLIENTS"
  82. File "..\doc\tor-spec.txt"
  83. File "..\doc\FAQ"
  84. File "..\doc\HACKING"
  85. File "..\doc\rend-spec.txt"
  86. File "..\doc\control-spec.txt"
  87. File "..\doc\tor-doc.html"
  88. File "..\doc\tor-doc.css"
  89. File "..\doc\tor-resolve.html"
  90. File "..\doc\tor-reference.html"
  91. File "..\doc\tor-design.pdf"
  92. File "..\README"
  93. File "..\AUTHORS"
  94. File "..\ChangeLog"
  95. SectionEnd
  96. SubSection /e "Shortcuts" Shortcuts
  97. Section "Start Menu" StartMenu
  98. SetOutPath $INSTDIR
  99. IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
  100. RMDir /r "$SMPROGRAMS\Tor"
  101. CreateDirectory "$SMPROGRAMS\Tor"
  102. CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe"
  103. CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
  104. CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
  105. CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  106. IfFileExists "$INSTDIR\Documents\*.*" "" +4
  107. CreateDirectory "$SMPROGRAMS\Tor\Documents"
  108. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents\tor-doc.html"
  109. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
  110. SectionEnd
  111. Section "Desktop" Desktop
  112. SetOutPath $INSTDIR
  113. CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe"
  114. SectionEnd
  115. Section /o "Run at startup" Startup
  116. SetOutPath $INSTDIR
  117. CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "" 0 SW_SHOWMINIMIZED
  118. SectionEnd
  119. SubSectionEnd
  120. Section "Uninstall"
  121. Delete "$DESKTOP\Tor.lnk"
  122. Delete "$INSTDIR\libeay32.dll"
  123. Delete "$INSTDIR\ssleay32.dll"
  124. Delete "$INSTDIR\tor.exe"
  125. Delete "$INSTDIR\Tor Website.url"
  126. Delete "$INSTDIR\torrc"
  127. Delete "$INSTDIR\torrc.sample"
  128. StrCmp $configdir $INSTDIR +2 ""
  129. RMDir /r $configdir
  130. Delete "$INSTDIR\Uninstall.exe"
  131. RMDir /r "$INSTDIR\Documents"
  132. RMDir $INSTDIR
  133. RMDir /r "$SMPROGRAMS\Tor"
  134. Delete "$SMSTARTUP\Tor.lnk"
  135. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
  136. SectionEnd
  137. Section -End
  138. WriteUninstaller "$INSTDIR\Uninstall.exe"
  139. ;The registry entries simply add the Tor uninstaller to the Windows
  140. ;uninstall list.
  141. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
  142. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  143. SectionEnd
  144. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  145. !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
  146. !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
  147. !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
  148. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
  149. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
  150. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
  151. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
  152. !insertmacro MUI_FUNCTION_DESCRIPTION_END