1 ## NOTE: tor.spec is autogenerated from tor.spec.in . Edit the latter,
4 ## Things that need to be edited frequently
6 # This should be incremented whenever the spec file changes, but
7 # can drop back to zero at a new Tor version
11 ## Things users may want to change
13 # User (and group) name under which the Tor daemon runs
17 ## Version song and dance
19 # This should be the Tor version number, as it appears on the tarball,
20 # including any "pre<x>" or "rc<y>" suffix. This gets massaged to
21 # create the RPM version number, in a way that depends on the Tor
23 %define native_version @VERSION@
25 %define version %
(echo %{native_version} | sed
-e 's
/-/.
/g'
)
27 ## Release and OS identification song and dance
29 # This identifies the lineage of the spec file. This file is the
30 # standard one that comes with Tor; various distributions may
31 # have their own ideas about the right ways to do things.
34 # This spec is intended to build and install on multiple distributions.
35 # Detect the distribution we're building on.
37 %define is_rh %
(test -e
/etc
/redhat
-release
&& echo 1 ||
echo 0)
38 %define is_fc %
(test -e
/etc
/fedora
-release
&& echo 1 ||
echo 0)
39 %define is_mdk %
(test -e
/etc
/mandrake
-release
&& echo 1 ||
echo 0)
40 %define is_suse %
(test -e
/etc
/SuSE
-release
&& echo 1 ||
echo 0)
43 %define ostag %
(sed
-e 's
/^.
*release
/fc/'
-e 's
/ .
*$
//'
-e 's
/\\.
/_
/g'
< /etc
/fedora
-release
)
46 %define ostag %
(sed
-e 's
/^.
*release
/rh
/'
-e 's
/ .
*$
//'
-e 's
/\\.
/_
/g'
< /etc
/redhat
-release
)
50 # These are probably wrong... just placeholders should we actually
51 # end up supporting these distributions
61 # Using the build date ensures that every build really does get
62 # a different release number. We use this trick for CVS versions.
63 # For release versions, we don't want or need it.
64 %define is_cvs_version %
(echo %{native_version} | grep 'cvs'
> /dev
/null
&& echo 1 ||
echo 0)
67 %define blddate %
(date
-u
+"
%Y%m%d%H%M"
)
68 %define release
%{pkgspec}.%{specver}.%{ostag}.%{blddate}
70 %define release
%{pkgspec}.%{specver}.%{ostag}
73 ## General-purpose macros
75 # Some systems don't have some macros. If a macro doesn't seem
76 # to exist on your system, add it here...
78 %if %{!?__make:1}%{?__make:0}
82 %if %{!?make:1}%{?make:0}
83 %define make %{__make}
86 %if %{!?_localstatedir:1}%{?_localstatedir:0}
87 %define _localstatedir @LOCALSTATEDIR@
90 ## Package information
96 Summary: Anonymizing overlay network
for TCP
(The onion router
)
97 URL: http
://tor.eff.org
/
98 Group: System Environment
/Daemons
101 Vendor: R. Dingledine
<arma@seul.org
>
102 Packager: Nick Mathewson
<nickm@seul.org
>
104 Requires: openssl
>= 0.9.6
105 BuildRequires
: openssl
-devel
>= 0.9.6, rpm
-build
>= 4.0
106 Requires(pre
): shadow
-utils
, /usr
/bin
/id
, /bin
/date
, /bin
/sh
107 Requires(pre
): %{_sbindir}/useradd, %{_sbindir}/groupadd
109 Source0: http
://tor.eff.org
/dist
/%{name}-%{native_version}.tar.gz
111 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
114 Tor is a connection
-based low
-latency anonymous communication system.
116 This package provides the "tor" program
, which serves as both a client and
117 a relay node. Scripts will automatically create a "
%{runuser}" user and
118 group
, and
set tor up to run as a daemon when the system is rebooted.
120 Applications connect to the
local Tor proxy using the SOCKS
121 protocol. The
local proxy chooses a path through a
set of relays
, in
122 which each relay knows its predecessor and successor
, but no
123 others. Traffic flowing down the circuit is unwrapped by a symmetric
124 key at each relay
, which reveals the downstream relay.
126 Warnings
: Tor does no protocol cleaning. That means there is a danger
127 that application protocols and associated programs can be induced to
128 reveal information about the initiator. Tor depends on Privoxy and
129 similar protocol cleaners to solve this problem. This is alpha code
,
130 and is even more likely than released code to have anonymity
-spoiling
131 bugs. The present network is very small
-- this further reduces the
132 strength of the anonymity provided. Tor is not presently suitable
133 for high
-stakes anonymity.
136 %setup -q
-n
%{name}-%{native_version}
138 # Patch the startup script to use the right user and group IDs. Force
139 # the use of /bin/sh as the shell for the "tor" account.
140 ed
-s contrib
/tor.sh.
in << '
/EOF
/'
> /dev
/null
141 ,s
/^TORUSER
=$
/TORUSER
=%{runuser}/
142 ,s
/^TORGROUP
=$
/TORGROUP
=%{runuser}/
143 ,s
:\$SUPROG
:$SUPROG
-s
/bin
/sh
:
157 # Install init script.
158 %__mkdir_p $
{RPM_BUILD_ROOT
}%{_initrddir}
159 %__install -p
-m
755 contrib
/tor.sh $
{RPM_BUILD_ROOT
}%{_initrddir}/%{name}
161 # Set up config file; "sample" file implements a basic user node.
162 %__install -p
-m
644 $
{RPM_BUILD_ROOT
}%{_sysconfdir}/%{name}/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc
164 # Create a logrotate file. This should really be a source file,
166 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_sysconfdir}/logrotate.d
167 %__cat > $
{RPM_BUILD_ROOT
}%{_sysconfdir}/logrotate.d/%{name} << /EOF
/
168 %{_localstatedir}/log/%{name}/*log
{
177 /etc
/rc.d
/init.d
/tor reload
> /dev
/null
182 # Directories that don't have any preinstalled files
183 %__mkdir_p -m
700 $
{RPM_BUILD_ROOT
}%{_localstatedir}/lib/%{name}
184 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_localstatedir}/run/%{name}
185 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_localstatedir}/log/%{name}
188 [ "$
{RPM_BUILD_ROOT
}"
!= "
/"
] && rm -rf $
{RPM_BUILD_ROOT
}
190 # These scripts are probably wrong for Mandrake or SuSe. They're certainly
191 # wrong for Debian, but what are you doing using RPM on Debian?
193 [ -f
%{_initrddir}/%{name} ] && /sbin/service %{name} stop
194 if [ ! -n "`
/usr
/bin
/id
-g
%{runuser} 2>/dev
/null`"
]; then
195 # One would like to default the GID, but doing that properly would
197 %{_sbindir}/groupadd %{runuser} 2> /dev
/null
199 if [ ! -n "`
/usr
/bin
/id
-u
%{runuser} 2>/dev
/null`"
]; then
200 # One would also like to default the UID, but doing that properly would
201 # also require thought.
202 if [ -x
/sbin
/nologin
]; then
203 %{_sbindir}/useradd -r -g %{runuser} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin %{runuser} 2> /dev
/null
205 %{_sbindir}/useradd -r -g %{runuser} -d %{_localstatedir}/lib/%{name} -s /bin/false %{runuser} 2> /dev
/null
211 /sbin
/chkconfig
--add
%{name}
215 /sbin
/chkconfig
--del
%{name}
216 %__rm -f $
{_localstatedir
}/lib
/%{name}/cached
-directory
217 %__rm -f $
{_localstatedir
}/lib
/%{name}/bw_accounting
218 %__rm -f $
{_localstatedir
}/lib
/%{name}/control_auth_cookie
219 %__rm -f $
{_localstatedir
}/lib
/%{name}/router.desc
220 %__rm -f $
{_localstatedir
}/lib
/%{name}/fingerprint
224 %defattr(-,root
,root
)
225 %doc AUTHORS INSTALL LICENSE README ChangeLog doc
/HACKING doc
/TODO doc
/FAQ
229 %{_bindir}/tor
-resolve
230 %config %{_initrddir}/%{name}
231 %config(noreplace
) %attr(0644,root
,root
) %{_sysconfdir}/logrotate.d/%{name}
232 %dir %attr(0755,root
,%{runuser}) %{_sysconfdir}/%{name}/
233 %config(noreplace
) %attr(0644,root
,%{runuser}) %{_sysconfdir}/%{name}/*
234 %attr(0700,%{runuser},%{runuser}) %dir %{_localstatedir}/lib/%{name}
235 %attr(0750,%{runuser},%{runuser}) %dir %{_localstatedir}/run/%{name}
236 %attr(0750,%{runuser},%{runuser}) %dir %{_localstatedir}/log/%{name}
239 * Tue Nov
5 2004 John Bashinski
<jbash@velvet.com
>
240 - Add skeletal support
for multiple distributions
241 - Even more ridiculous level of macro
-ization
242 - Modify version numbers so RPM can determine when it has a newer version
243 - Return to including distribution name
in package release number
244 - Sharply trim description
245 - Change user
/group name from "tor" to "tordmn"
; "tor" is a common
246 given name
(reported by Marius Hjelle
)
247 - Change group to "System Environment
/Daemons"
(suggested by Marius Hjelle
)
248 - Create logrotate file
(suggested by Marius Hjelle
)
249 - Make Tor run as a user proxy by default
(suggested by Marius Hjelle
)
250 - Autogenerate spec file from GNU autotools data
, substituting version
252 - Be perhaps excessively paranoid with config file and directory modes
253 - Remove auto
-start and auto
-stop at installation
time; there's some kind
254 of weird race going on
, and it's arguably a bad thing anyway.
256 * Mon Jun
06 2004 Nick Mathewson
<nickm@freehaven.net
> 0.0.7-0.std
.0.1.rc2
257 - Make spec file more happy with fc2 packaging
259 * Sat Jan
17 2004 John Bashinski
<jbash@velvet.com
>
260 - Basic spec file
; tested with Red Hat
9.