tor-mingw.nsi.in 6.6 KB

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