tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

tor.nsi.in (8305B)


      1 ;tor.nsi - A basic win32 installer for Tor
      2 ; Originally written by J Doe.
      3 ; See LICENSE for licensing information
      4 ;-----------------------------------------
      5 ; NOTE: This file might be obsolete. Look at tor-mingw.nsi.in instead.
      6 ;-----------------------------------------
      7 ; How to make an installer:
      8 ;   Step 0. If you are a Tor maintainer, make sure that tor.nsi has
      9 ;           the correct version number.
     10 ;   Step 1. Download and install OpenSSL.  Make sure that the OpenSSL
     11 ;           version listed below matches the one you downloaded.
     12 ;   Step 2. Download and install NSIS (http://nsis.sourceforge.net)
     13 ;   Step 3. Make a directory under the main tor directory called "bin".
     14 ;   Step 4. Copy ssleay32.dll and libeay32.dll from OpenSSL into "bin".
     15 ;   Step 5. Run man2html on tor.1.in; call the result tor-reference.html
     16 ;           Run man2html on tor-resolve.1; call the result tor-resolve.html
     17 ;   Step 6. Copy torrc.sample.in to torrc.sample.
     18 ;   Step 7. Build tor.exe and tor_resolve.exe; save the result into bin.
     19 ;   Step 8. cd into contrib and run "makensis tor.nsi".
     20 ;
     21 ; Problems:
     22 ;   - Copying torrc.sample.in to torrc.sample and tor.1.in (implicitly)
     23 ;     to tor.1 is a Bad Thing, and leaves us with @autoconf@ vars in the final
     24 ;     result.
     25 ;   - Building Tor requires too much windows C clue.
     26 ;     - We should have actual makefiles for VC that do the right thing.
     27 ;   - I need to learn more NSIS juju to solve these:
     28 ;     - There should be a batteries-included installer that comes with
     29 ;       privoxy too. (Check privoxy license on this; be sure to include
     30 ;       all privoxy documents.)
     31 ;   - The filename should probably have a revision number.
     32 
     33 !include "MUI.nsh"
     34 
     35 !define VERSION "0.1.2.3-alpha-dev"
     36 !define INSTALLER "tor-${VERSION}-win32.exe"
     37 !define WEBSITE "https://www.torproject.org/"
     38 
     39 !define LICENSE "..\LICENSE"
     40 ;BIN is where it expects to find tor.exe, tor_resolve.exe, libeay32.dll and
     41 ;  ssleay32.dll
     42 !define BIN "..\bin"
     43 
     44 SetCompressor lzma
     45 ;SetCompressor zlib
     46 OutFile ${INSTALLER}
     47 InstallDir $PROGRAMFILES\Tor
     48 SetOverWrite ifnewer
     49 
     50 Name "Tor"
     51 Caption "Tor ${VERSION} Setup"
     52 BrandingText "The Onion Router"
     53 CRCCheck on
     54 
     55 ;Use upx on the installer header to shrink the size.
     56 !packhdr header.dat "upx --best header.dat"
     57 
     58 !define MUI_WELCOMEPAGE_TITLE "Welcome to the Tor ${VERSION} Setup Wizard"
     59 !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"
     60 !define MUI_ABORTWARNING
     61 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
     62 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
     63 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
     64 !define MUI_HEADERIMAGE
     65 !define MUI_FINISHPAGE_RUN "$INSTDIR\tor.exe"
     66 !define MUI_FINISHPAGE_LINK "Visit the Tor website for the latest updates."
     67 !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
     68 
     69 !insertmacro MUI_PAGE_WELCOME
     70 ; There's no point in having a clickthrough license: Our license adds
     71 ; certain rights, but doesn't remove them.
     72 ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
     73 !insertmacro MUI_PAGE_COMPONENTS
     74 !insertmacro MUI_PAGE_DIRECTORY
     75 !insertmacro MUI_PAGE_INSTFILES
     76 !insertmacro MUI_PAGE_FINISH
     77 !insertmacro MUI_UNPAGE_WELCOME
     78 !insertmacro MUI_UNPAGE_CONFIRM
     79 !insertmacro MUI_UNPAGE_INSTFILES
     80 !insertmacro MUI_UNPAGE_FINISH
     81 !insertmacro MUI_LANGUAGE "English"
     82 
     83 Var configdir
     84 Var configfile
     85 
     86 ;Sections
     87 ;--------
     88 
     89 Section "Tor" Tor
     90 ;Files that have to be installed for tor to run and that the user
     91 ;cannot choose not to install
     92    SectionIn RO
     93    SetOutPath $INSTDIR
     94    File "${BIN}\tor.exe"
     95    File "${BIN}\tor_resolve.exe"
     96    WriteIniStr "$INSTDIR\Tor Website.url" "InternetShortcut" "URL" ${WEBSITE}
     97 
     98    StrCpy $configfile "torrc"
     99    StrCpy $configdir $APPDATA\Tor
    100 ;   ;If $APPDATA isn't valid here (Early win95 releases with no updated
    101 ;   ; shfolder.dll) then we put it in the program directory instead.
    102 ;   StrCmp $APPDATA "" "" +2
    103 ;      StrCpy $configdir $INSTDIR
    104    SetOutPath $configdir
    105    ;If there's already a torrc config file, ask if they want to
    106    ;overwrite it with the new one.
    107    IfFileExists "$configdir\torrc" "" endiftorrc
    108       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
    109       Delete $configdir\torrc
    110       Goto endiftorrc
    111      yesreplace:
    112       StrCpy $configfile "torrc.sample"
    113    endiftorrc:
    114    File /oname=$configfile "..\src\config\torrc.sample"
    115 SectionEnd
    116 
    117 Section "OpenSSL 0.9.8a" OpenSSL
    118    SetOutPath $INSTDIR
    119    File "${BIN}\libeay32.dll"
    120    File "${BIN}\ssleay32.dll"
    121 SectionEnd
    122 
    123 Section "Documents" Docs
    124    SetOutPath "$INSTDIR\Documents"
    125    ;File "..\doc\FAQ"
    126    File "..\doc\HACKING"
    127    File "..\doc\spec\control-spec.txt"
    128    File "..\doc\spec\dir-spec.txt"
    129    File "..\doc\spec\rend-spec.txt"
    130    File "..\doc\spec\socks-extensions.txt"
    131    File "..\doc\spec\tor-spec.txt"
    132    File "..\doc\spec\version-spec.txt"
    133    ;
    134    ; WEBSITE-FILES-HERE
    135    ;
    136    File "..\doc\tor-resolve.html"
    137    File "..\doc\tor-reference.html"
    138    ;
    139    File "..\doc\design-paper\tor-design.pdf"
    140    ;
    141    File "..\README"
    142    File "..\AUTHORS"
    143    File "..\ChangeLog"
    144    File "..\LICENSE"
    145 SectionEnd
    146 
    147 SubSection /e "Shortcuts" Shortcuts
    148 
    149 Section "Start Menu" StartMenu
    150    SetOutPath $INSTDIR
    151    IfFileExists "$SMPROGRAMS\Tor\*.*" "" +2
    152       RMDir /r "$SMPROGRAMS\Tor"
    153    CreateDirectory "$SMPROGRAMS\Tor"
    154    CreateShortCut "$SMPROGRAMS\Tor\Tor.lnk" "$INSTDIR\tor.exe"
    155    CreateShortCut "$SMPROGRAMS\Tor\Torrc.lnk" "Notepad.exe" "$configdir\torrc"
    156    CreateShortCut "$SMPROGRAMS\Tor\Tor Website.lnk" "$INSTDIR\Tor Website.url"
    157    CreateShortCut "$SMPROGRAMS\Tor\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
    158    IfFileExists "$INSTDIR\Documents\*.*" "" endifdocs
    159       CreateDirectory "$SMPROGRAMS\Tor\Documents"
    160       CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Manual.lnk" "$INSTDIR\Documents\tor-reference.html"
    161       CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Documents"
    162       CreateShortCut "$SMPROGRAMS\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Documents\tor-spec.txt"
    163    endifdocs:
    164 SectionEnd
    165 
    166 Section "Desktop" Desktop
    167    SetOutPath $INSTDIR
    168    CreateShortCut "$DESKTOP\Tor.lnk" "$INSTDIR\tor.exe"
    169 SectionEnd
    170 
    171 Section /o "Run at startup" Startup
    172    SetOutPath $INSTDIR
    173    CreateShortCut "$SMSTARTUP\Tor.lnk" "$INSTDIR\tor.exe" "" "" 0 SW_SHOWMINIMIZED
    174 SectionEnd
    175 
    176 SubSectionEnd
    177 
    178 Section "Uninstall"
    179    Delete "$DESKTOP\Tor.lnk"
    180    Delete "$INSTDIR\libeay32.dll"
    181    Delete "$INSTDIR\ssleay32.dll"
    182    Delete "$INSTDIR\tor.exe"
    183    Delete "$INSTDIR\tor_resolve.exe"
    184    Delete "$INSTDIR\Tor Website.url"
    185    Delete "$INSTDIR\torrc"
    186    Delete "$INSTDIR\torrc.sample"
    187    StrCmp $configdir $INSTDIR +2 ""
    188       RMDir /r $configdir
    189    Delete "$INSTDIR\Uninstall.exe"
    190    RMDir /r "$INSTDIR\Documents"
    191    RMDir $INSTDIR
    192    RMDir /r "$SMPROGRAMS\Tor"
    193    Delete "$SMSTARTUP\Tor.lnk"
    194    DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor"
    195 SectionEnd
    196 
    197 Section -End
    198     WriteUninstaller "$INSTDIR\Uninstall.exe"
    199     ;The registry entries simply add the Tor uninstaller to the Windows
    200     ;uninstall list.
    201     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "Tor (remove only)"
    202     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
    203 SectionEnd
    204 
    205 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    206   !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "The core executable and config files needed for Tor to run."
    207   !insertmacro MUI_DESCRIPTION_TEXT ${OpenSSL} "OpenSSL libraries required by Tor."
    208   !insertmacro MUI_DESCRIPTION_TEXT ${Docs} "Documentation about Tor."
    209   !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Tor"
    210   !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Tor and its documentation from the Start Menu"
    211   !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Tor from the desktop"
    212   !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Tor automatically at startup in a minimized window"
    213 !insertmacro MUI_FUNCTION_DESCRIPTION_END
    214