tor-mingw.nsi.in 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 "%VERSION%"
  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
  12. ;and libssl.a
  13. !define BIN "..\bin"
  14. SetCompressor lzma
  15. ;SetCompressor zlib
  16. OutFile ${INSTALLER}
  17. InstallDir $PROGRAMFILES\Tor
  18. SetOverWrite ifnewer
  19. Name "Tor"
  20. Caption "Tor ${VERSION} Setup"
  21. BrandingText "The Onion Router"
  22. CRCCheck on
  23. XPStyle 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. ; There's no point in having a clickthrough license: Our license adds
  38. ; certain rights, but doesn't remove them.
  39. ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
  40. !insertmacro MUI_PAGE_COMPONENTS
  41. !insertmacro MUI_PAGE_DIRECTORY
  42. !insertmacro MUI_PAGE_INSTFILES
  43. !insertmacro MUI_PAGE_FINISH
  44. !insertmacro MUI_UNPAGE_WELCOME
  45. !insertmacro MUI_UNPAGE_CONFIRM
  46. !insertmacro MUI_UNPAGE_INSTFILES
  47. !insertmacro MUI_UNPAGE_FINISH
  48. !insertmacro MUI_LANGUAGE "English"
  49. Var configdir
  50. Var configfile
  51. ;Sections
  52. ;--------
  53. Section "Tor" Tor
  54. ;Files that have to be installed for tor to run and that the user
  55. ;cannot choose not to install
  56. SectionIn RO
  57. SetOutPath $INSTDIR
  58. File "${BIN}\tor.exe"
  59. File "${BIN}\tor-resolve.exe"
  60. File "${BIN}\tor.ico"
  61. WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
  62. StrCpy $configfile "torrc"
  63. StrCpy $configdir $APPDATA\Tor
  64. ; ;If $APPDATA isn't valid here (Early win95 releases with no updated
  65. ; ; shfolder.dll) then we put it in the program directory instead.
  66. ; StrCmp $APPDATA "" "" +2
  67. ; StrCpy $configdir $INSTDIR
  68. SetOutPath $configdir
  69. ;If there's already a torrc config file, ask if they want to
  70. ;overwrite it with the new one.
  71. IfFileExists "$configdir\torrc" "" endiftorrc
  72. 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
  73. Delete $configdir\torrc
  74. Goto endiftorrc
  75. yesreplace:
  76. StrCpy $configfile "torrc.sample"
  77. endiftorrc:
  78. File /oname=$configfile "..\src\config\torrc.sample"
  79. SectionEnd
  80. Section "OpenSSL 0.9.8c" OpenSSL
  81. SetOutPath $INSTDIR
  82. File "${BIN}\libcrypto.a"
  83. File "${BIN}\libssl.a"
  84. SectionEnd
  85. Section "Documents" Docs
  86. SetOutPath "$INSTDIR\Documents"
  87. ;File "doc\FAQ"
  88. File "..\doc\HACKING"
  89. File "..\doc\control-spec.txt"
  90. File "..\doc\dir-spec.txt"
  91. File "..\doc\rend-spec.txt"
  92. File "..\doc\socks-extensions.txt"
  93. File "..\doc\version-spec.txt"
  94. ;
  95. ; WEBSITE-FILES-HERE
  96. ;
  97. File "..\doc\tor-resolve.html"
  98. File "..\doc\tor-reference.html"
  99. ;
  100. File "..\doc\design-paper\tor-design.pdf"
  101. ;
  102. File "..\README"
  103. File "..\AUTHORS"
  104. File "..\ChangeLog"
  105. File "..\LICENSE"
  106. SectionEnd
  107. SubSection /e "Shortcuts" Shortcuts
  108. Section "Start Menu" StartMenu
  109. SetOutPath $INSTDIR
  110. IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
  111. RMDir /r "$SMPROGRAMS\Tor"
  112. CreateDirectory "$SMPROGRAMS\Tor"
  113. CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
  114. CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
  115. CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
  116. CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  117. IfFileExists "$INSTDIR\Documents\*.*" "" endifdocs
  118. CreateDirectory "$SMPROGRAMS\Tor\Documents"
  119. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Manual.lnk" "$INSTDIR\Documents\tor-doc.html"
  120. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents"
  121. CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
  122. endifdocs:
  123. SectionEnd
  124. Section "Desktop" Desktop
  125. SetOutPath $INSTDIR
  126. CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico"
  127. SectionEnd
  128. Section /o "Run at startup" Startup
  129. SetOutPath $INSTDIR
  130. CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "$INSTDIR\tor.ico" "" SW_SHOWMINIMIZED
  131. SectionEnd
  132. SubSectionEnd
  133. Section "Uninstall"
  134. Delete "$DESKTOP\Tor.lnk"
  135. Delete "$INSTDIR\libcrypto.a"
  136. Delete "$INSTDIR\libssl.a"
  137. Delete "$INSTDIR\tor.exe"
  138. Delete "$INSTDIR\tor-resolve.exe"
  139. Delete "$INSTDIR\Tor Website.url"
  140. Delete "$INSTDIR\torrc"
  141. Delete "$INSTDIR\torrc.sample"
  142. Delete "$INSTDIR\tor.ico"
  143. StrCmp $configdir $INSTDIR +2 ""
  144. RMDir /r $configdir
  145. Delete "$INSTDIR\Uninstall.exe"
  146. RMDir /r "$INSTDIR\Documents"
  147. RMDir $INSTDIR
  148. RMDir /r "$SMPROGRAMS\Tor"
  149. RMDir /r "$APPDATA\Tor"
  150. Delete "$SMSTARTUP\Tor.lnk"
  151. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
  152. SectionEnd
  153. Section -End
  154. WriteUninstaller "$INSTDIR\Uninstall.exe"
  155. ;The registry entries simply add the Tor uninstaller to the Windows
  156. ;uninstall list.
  157. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
  158. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  159. SectionEnd
  160. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  161. !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
  162. !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
  163. !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
  164. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
  165. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and it's documentation from the Start Menu"
  166. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
  167. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
  168. !insertmacro MUI_FUNCTION_DESCRIPTION_END