tor.spec.in 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. %define rellevel 2
  2. %define relbase std.%{rellevel}
  3. %define rhrel %([ -f /etc/redhat-release ] && (sed -e 's/^Red Hat Linux release //' -e 's/ .*$//' -e 's/\\./_/g' -e 's/^.*$/.rh&/' < /etc/redhat-release))
  4. %define blddate %(date -u +"%Y%m%d%H%M")
  5. %define release %{relbase}%{rhrel}.%{blddate}
  6. %define initdir /etc/rc.d/init.d
  7. Summary: tor: The Onion Router; patent-free Onion Routing
  8. Name: tor
  9. Version: @VERSION@
  10. Vendor: R. Dingledine <arma@seul.org>
  11. Release: %{release}
  12. License: BSD-like
  13. Group: Applications/Internet
  14. URL: http://freehaven.net/tor
  15. Source0: http://freehaven.net/tor/dist/tor-%{version}.tar.gz
  16. Requires(pre): shadow-utils, /usr/bin/id, /bin/date, /bin/sh
  17. Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
  18. BuildRoot: %{_tmppath}/%{name}-%{version}-%{relbase}-root
  19. %description
  20. Tor is a system that conceals the sources of TCP connections
  21. by relaying those connections through multiple independently administered
  22. forwarding nodes; it is a "cascaded mix" system. Among older systems,
  23. Tor is most similar to Onion Routing. The basic concept of Tor is also
  24. similar to that of the Zero Knowledge Freedom system or the Java Anonymous
  25. Proxy. The "onions" used in Tor are similar in concept to the reply blocks
  26. used with type I "cypherpunks" anonymous remailers. Feeding phrases
  27. from this paragraph into search engines should give you more background
  28. information than you really want.
  29. This package provides the "tor" program, which serves as both a client
  30. and a relay node. Scripts will automatically create a "tor" user and
  31. group, set tor up to run as a daemon, and automatically start it at
  32. installation time.
  33. %prep
  34. %setup -q
  35. # Patch the startup script to use the right user and group IDs. Force
  36. # the use of /bin/sh as the shell for the "tor" account.
  37. ed -s contrib/tor.sh.in << '/EOF/' > /dev/null
  38. ,s/^TORUSER=$/TORUSER=tor/
  39. ,s/^TORGROUP=$/TORGROUP=tor/
  40. ,s:/bin/su:/bin/su -s /bin/sh:
  41. #
  42. # Save and exit ed
  43. w
  44. q
  45. /EOF/
  46. %build
  47. %configure
  48. %__make
  49. %install
  50. %makeinstall
  51. # Install init script.
  52. %__mkdir_p ${RPM_BUILD_ROOT}%{initdir}
  53. %__install -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{initdir}/tor
  54. # Directories that don't have any preinstalled files
  55. %__mkdir_p -m 700 ${RPM_BUILD_ROOT}/var/lib/tor
  56. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/run/tor
  57. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/log/tor
  58. %clean
  59. [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  60. %pre
  61. [ -f %{initdir}/tor ] && /sbin/service tor stop
  62. if [ ! -n "`/usr/bin/id -g tor 2>/dev/null`" ]; then
  63. # One would like to default the GID, but doing that properly would
  64. # require thought.
  65. %{_sbindir}/groupadd tor 2> /dev/null
  66. fi
  67. if [ ! -n "`/usr/bin/id -u tor 2>/dev/null`" ]; then
  68. # One would also like to default the UID, but doing that properly would
  69. # also require thought.
  70. if [ -x /sbin/nologin ]; then
  71. %{_sbindir}/useradd -r -g tor -d / -s /sbin/nologin tor 2> /dev/null
  72. else
  73. %{_sbindir}/useradd -r -g tor -d / -s /bin/false tor 2> /dev/null
  74. fi
  75. fi
  76. %post
  77. /sbin/chkconfig --add tor
  78. /sbin/chkconfig tor && /sbin/service tor start
  79. %preun
  80. /sbin/chkconfig tor && /sbin/service tor stop
  81. /sbin/chkconfig --del tor
  82. %files
  83. %defattr(-,root,root)
  84. %doc AUTHORS INSTALL LICENSE README
  85. %{_mandir}/man*/*
  86. %{_bindir}/tor
  87. %{_bindir}/torify
  88. %{initdir}/tor
  89. %dir %{_sysconfdir}/tor/
  90. %config(noreplace) %{_sysconfdir}/tor/torrc
  91. %config(noreplace) %{_sysconfdir}/tor/dirservers
  92. %config(noreplace) %{_sysconfdir}/tor/tor-tsocks.conf
  93. %attr(-,tor,tor) %dir /var/lib/tor
  94. %attr(-,tor,tor) %dir /var/run/tor
  95. %attr(-,tor,tor) %dir /var/log/tor
  96. %changelog
  97. * Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
  98. - Basic spec file; tested with Red Hat 9.