tor.spec 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ##
  2. ## tor.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_dist 0.1.1.11-alpha
  26. %define V_opkg 0.1.1.11
  27. # package information
  28. Name: tor
  29. Summary: Anonymous Internet Communication System
  30. URL: http://tor.eff.org/
  31. Vendor: R. Dingledine & N. Mathewson
  32. Packager: OpenPKG
  33. Distribution: OpenPKG
  34. Class: PLUS
  35. Group: Network
  36. License: LGPL
  37. Version: %{V_opkg}
  38. Release: 20060111
  39. # list of sources
  40. Source0: http://tor.eff.org/dist/tor-%{V_dist}.tar.gz
  41. Source1: rc.tor
  42. Source2: torrc
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
  47. PreReq: OpenPKG, openpkg >= 20040130, tsocks
  48. BuildPreReq: openssl, libevent, zlib
  49. PreReq: openssl, libevent, zlib
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. Tor is a toolset for a wide range of organizations and people
  54. that want to improve their safety and security on the Internet.
  55. Using Tor can help you anonymize web browsing and publishing,
  56. instant messaging, IRC, SSH, and other applications that use the TCP
  57. protocol. Tor also provides a platform on which software developers
  58. can build new applications with built-in anonymity, safety, and
  59. privacy features. Your traffic is safer when you use Tor, because
  60. communications are bounced around a distributed network of servers,
  61. called onion routers. Instead of taking a direct route from source to
  62. destination, data packets on the Tor network take a random pathway
  63. through several servers that cover your tracks so no observer at any
  64. single point can tell where the data came from or where it's going.
  65. %track
  66. prog tor = {
  67. version = %{V_dist}
  68. url = http://tor.eff.org/dist/
  69. regex = tor-(\d+\.\d+(\.\d+)*(-(alpha|beta))?)\.tar\.gz
  70. }
  71. %prep
  72. %setup -q -n tor-%{V_dist}
  73. %build
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. CPPFLAGS="%{l_cppflags}" \
  77. LDFLAGS="%{l_ldflags}" \
  78. ./configure \
  79. --prefix=%{l_prefix} \
  80. --with-ssl-dir=%{l_prefix}
  81. %{l_make} %{l_mflags -O}
  82. %install
  83. rm -rf $RPM_BUILD_ROOT
  84. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  85. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  86. mv $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc.sample \
  87. $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc
  88. %{l_shtool} subst \
  89. -e 's;exec tsocks;exec %{l_prefix}/bin/tsocks;' \
  90. $RPM_BUILD_ROOT%{l_prefix}/bin/torify
  91. %{l_shtool} mkdir -f -p -m 755 \
  92. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  93. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  94. %{SOURCE rc.tor} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  95. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  96. %{SOURCE torrc} $RPM_BUILD_ROOT%{l_prefix}/etc/tor/
  97. %{l_shtool} mkdir -f -p -m 755 \
  98. $RPM_BUILD_ROOT%{l_prefix}/var/tor/db
  99. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  100. %{l_files_std} \
  101. '%config %{l_prefix}/etc/tor/*' \
  102. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor' \
  103. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor/db'
  104. %files -f files
  105. %clean
  106. rm -rf $RPM_BUILD_ROOT
  107. %post
  108. # after upgrade, restart service
  109. [ $1 -eq 2 ] || exit 0
  110. eval `%{l_rc} tor status 2>/dev/null`
  111. [ ".$tor_active" = .yes ] && %{l_rc} tor restart
  112. exit 0
  113. %preun
  114. # before erase, stop service and remove log files
  115. [ $1 -eq 0 ] || exit 0
  116. %{l_rc} tor stop 2>/dev/null
  117. rm -f $RPM_INSTALL_PREFIX/var/tor/tor.* >/dev/null 2>&1 || true
  118. rm -f $RPM_INSTALL_PREFIX/var/tor/db/* >/dev/null 2>&1 || true
  119. exit 0