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.
15 %define toruser @TORUSER@
16 %define torgroup @TORGROUP@
18 ## Version song and dance
20 # This should be the Tor version number, as it appears on the tarball,
21 # including any "pre<x>" or "rc<y>" suffix. This gets massaged to
22 # create the RPM version number, in a way that depends on the Tor
24 %define native_version @VERSION@
26 %define version %
(echo %{native_version} | sed
-e 's
/-/.
/g'
)
28 ## Release and OS identification song and dance
30 # This identifies the lineage of the spec file. This file is the
31 # standard one that comes with Tor; various distributions may
32 # have their own ideas about the right ways to do things.
35 # This spec is intended to build and install on multiple distributions
36 # (someday). Detect the distribution we're building on.
38 %define is_rh %
(test -e
/etc
/redhat
-release
&& echo 1 ||
echo 0)
39 %define is_fc %
(test -e
/etc
/fedora
-release
&& echo 1 ||
echo 0)
40 %define is_mdk %
(test -e
/etc
/mandrake
-release
&& echo 1 ||
echo 0)
41 %define is_suse %
(test -e
/etc
/SuSE
-release
&& echo 1 ||
echo 0)
44 %define ostag %
(sed
-e 's
/^.
*release
/fc/'
-e 's
/ .
*$
//'
-e 's
/\\.
/_
/g'
< /etc
/fedora
-release
)
47 %define ostag %
(sed
-e 's
/^.
*release
/rh
/'
-e 's
/ .
*$
//'
-e 's
/\\.
/_
/g'
< /etc
/redhat
-release
)
51 # These are probably wrong... just placeholders should we actually
52 # end up supporting these distributions
62 # Using the build date ensures that every build really does get
63 # a different release number. We use this trick for CVS versions.
64 # For release versions, we don't want or need it.
65 %define is_cvs_version %
(echo %{native_version} | grep 'cvs'
> /dev
/null
&& echo 1 ||
echo 0)
68 %define blddate %
(date
-u
+"
%Y%m%d%H%M"
)
69 %define release
%{pkgspec}.%{specver}.%{ostag}.%{blddate}
71 %define release
%{pkgspec}.%{specver}.%{ostag}
74 ## General-purpose macros
76 # Some systems don't have some macros. If a macro doesn't seem
77 # to exist on your system, add it here...
79 %if %{!?__make:1}%{?__make:0}
83 %if %{!?make:1}%{?make:0}
84 %define make %{__make}
87 %if %{!?_localstatedir:1}%{?_localstatedir:0}
88 %define _localstatedir @LOCALSTATEDIR@
91 ## Package information
97 Summary: Anonymizing overlay network
for TCP
(The onion router
)
98 URL: http
://tor.eff.org
/
99 Group: System Environment
/Daemons
102 Vendor: R. Dingledine
<arma@seul.org
>
103 Packager: Nick Mathewson
<nickm@seul.org
>
105 Requires: openssl
>= 0.9.6
106 BuildRequires
: openssl
-devel
>= 0.9.6
108 BuildRequires
: rpm
-build
>= 4.0
111 BuildRequires
: rpm
>= 4.0, zlib
-devel
113 Requires(pre
): /usr
/bin
/id
, /bin
/date
, /bin
/sh
114 Requires(pre
): %{_sbindir}/useradd, %{_sbindir}/groupadd
116 Source0: http
://tor.eff.org
/dist
/%{name}-%{native_version}.tar.gz
118 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
121 Tor is a connection
-based low
-latency anonymous communication system.
123 This package provides the "tor" program
, which serves as both a client and
124 a relay node. Scripts will automatically create a "
%{toruser}" user and
125 a "
%{torgroup}" group
, and
set tor up to run as a daemon when the system
128 Applications connect to the
local Tor proxy using the SOCKS
129 protocol. The
local proxy chooses a path through a
set of relays
, in
130 which each relay knows its predecessor and successor
, but no
131 others. Traffic flowing down the circuit is unwrapped by a symmetric
132 key at each relay
, which reveals the downstream relay.
134 Warnings
: Tor does no protocol cleaning. That means there is a danger
135 that application protocols and associated programs can be induced to
136 reveal information about the initiator. Tor depends on Privoxy and
137 similar protocol cleaners to solve this problem. This is alpha code
,
138 and is even more likely than released code to have anonymity
-spoiling
139 bugs. The present network is very small
-- this further reduces the
140 strength of the anonymity provided. Tor is not presently suitable
141 for high
-stakes anonymity.
144 %setup -q
-n
%{name}-%{native_version}
147 %configure --with
-tor
-user
=%{toruser} --with-tor-group=%{torgroup}
153 # Install init script and control script
154 %__mkdir_p $
{RPM_BUILD_ROOT
}%{_initrddir}
155 %__install -p
-m
755 contrib
/tor.sh $
{RPM_BUILD_ROOT
}%{_initrddir}/%{name}
156 %__install -p
-m
755 contrib
/torctl $
{RPM_BUILD_ROOT
}%{_bindir}
158 # Set up config file; "sample" file implements a basic user node.
159 %__install -p
-m
644 $
{RPM_BUILD_ROOT
}%{_sysconfdir}/%{name}/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc
161 # Install the logrotate control file.
162 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_sysconfdir}/logrotate.d
163 %__install -p
-m
644 contrib
/tor.logrotate $
{RPM_BUILD_ROOT
}%{_sysconfdir}/logrotate.d/%{name}
165 # Directories that don't have any preinstalled files
166 %__mkdir_p -m
700 $
{RPM_BUILD_ROOT
}%{_localstatedir}/lib/%{name}
167 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_localstatedir}/run/%{name}
168 %__mkdir_p -m
755 $
{RPM_BUILD_ROOT
}%{_localstatedir}/log/%{name}
171 [ "$
{RPM_BUILD_ROOT
}"
!= "
/"
] && rm -rf $
{RPM_BUILD_ROOT
}
173 # These scripts are probably wrong for Mandrake or SuSE. They're certainly
174 # wrong for Debian, but what are you doing using RPM on Debian?
178 # If tor is already installed and running (whether installed by RPM
179 # or not), then kill it, but remember that it was running.
180 %__rm -f
/tmp
/$
{name
}-was
-running
-%{version}-%{release}
181 if [ -f
%{_initrddir}/%{name} ] && /sbin/service %{name} status
; then
182 /sbin
/service
%{name} stop
183 touch
/tmp
/$
{name
}-was
-running
-%{version}-%{release}
187 # Create a user and group if need be
189 if [ ! -n "`
/usr
/bin
/id
-g
%{torgroup} 2>/dev
/null`"
]; then
190 # One would like to default the GID, but doing that properly would
192 %{_sbindir}/groupadd %{torgroup} 2> /dev
/null
194 if [ ! -n "`
/usr
/bin
/id
-u
%{toruser} 2>/dev
/null`"
]; then
195 # One would also like to default the UID, but doing that properly would
196 # also require thought.
197 if [ -x
%{_sbindir}/nologin
]; then
198 %{_sbindir}/useradd -r -g %{torgroup} -d% {_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev
/null
200 %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev
/null
207 # If this is a new installation, use chkconfig to put tor in the
208 # default set of runlevels. If it's an upgrade, leave the existing
209 # configuration alone.
210 if [ $
1 -eq
1 ]; then
211 /sbin
/chkconfig
--add
%{name}
214 # Older tor RPMS used a different username for the tor daemon.
215 # Make sure the runtime data have the right ownership.
216 %__chown -R
%{toruser}.%{torgroup} %{_localstatedir}/{lib,log,run}/%{name}
218 if [ -f
/tmp
/$
{name
}-was
-running
-%{version}-%{release} ]; then
219 /sbin
/service
%{name} start
220 %__rm -f
/tmp
/$
{name
}-was
-running
-%{version}-%{release}
226 # If no instances of tor will be installed when we're done, make
227 # sure that it gets killed. We *don't* want to kill it or delete
228 # any of its data on uninstall if it's being upgraded to a new
229 # version, because the new version will actually already have
230 # been installed and started before the uninstall script for
231 # the old version is run, and we'd end up hosing it.
232 if [ $
1 -le
0 ]; then
233 if [ -f
%{_initrddir}/%{name} ] && /sbin/service %{name} status
; then
234 /sbin
/service
%{name} stop
236 %
/sbin
/chkconfig
--del
%{name}
237 %__rm -f $
{_localstatedir
}/lib
/%{name}/cached
-directory
238 %__rm -f $
{_localstatedir
}/lib
/%{name}/bw_accounting
239 %__rm -f $
{_localstatedir
}/lib
/%{name}/control_auth_cookie
240 %__rm -f $
{_localstatedir
}/lib
/%{name}/router.desc
241 %__rm -f $
{_localstatedir
}/lib
/%{name}/fingerprint
246 %defattr(-,root
,root
)
247 %doc AUTHORS INSTALL LICENSE README ChangeLog doc
/HACKING doc
/TODO doc
/FAQ
252 %{_bindir}/tor
-resolve
253 %config %{_initrddir}/%{name}
254 %config(noreplace
) %attr(0644,root
,root
) %{_sysconfdir}/logrotate.d/%{name}
255 %dir %attr(0755,root
,%{torgroup}) %{_sysconfdir}/%{name}/
256 %config(noreplace
) %attr(0644,root
,%{torgroup}) %{_sysconfdir}/%{name}/*
257 %attr(0700,%{toruser},%{torgroup}) %dir %{_localstatedir}/lib/%{name}
258 %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/run/%{name}
259 %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name}
263 * Mon Jan
17 2005 John Bashinski
<jbash@velvet.com
>
264 - Take runtime user and group names from configure system. Default
265 user
/group names are now "_tor"
; blame Roger...
266 - Make logrotate control file a separate file
in the
source distribution
,
267 rather than creating it from the spec file.
268 - Properly handle the order
in which RPM executes scriptlets on upgrade.
269 The old code would
kill the daemon on upgrade.
270 - Start the tor daemon after installation
if and only
if it was
271 running before installation. Preserve runlevel setup on upgrade.
272 - Package the torctl script
; the init script is now a wrapper around it.
274 * Tue Nov
5 2004 John Bashinski
<jbash@velvet.com
>
275 - Add skeletal support
for multiple distributions
276 - Even more ridiculous level of macro
-ization
277 - Modify version numbers so RPM can determine when it has a newer version
278 - Return to including distribution name
in package release number
279 - Sharply trim description
280 - Change user
/group name from "tor" to "tordmn"
; "tor" is a common
281 given name
(reported by Marius Hjelle
)
282 - Change group to "System Environment
/Daemons"
(suggested by Marius Hjelle
)
283 - Create logrotate file
(suggested by Marius Hjelle
)
284 - Make Tor run as a user proxy by default
(suggested by Marius Hjelle
)
285 - Autogenerate spec file from GNU autotools data
, substituting version
287 - Be perhaps excessively paranoid with config file and directory modes
288 - Remove auto
-start and auto
-stop at installation
time; there's some kind
289 of weird race going on
, and it's arguably a bad thing anyway.
291 * Mon Jun
06 2004 Nick Mathewson
<nickm@freehaven.net
> 0.0.7-0.std
.0.1.rc2
292 - Make spec file more happy with fc2 packaging
294 * Sat Jan
17 2004 John Bashinski
<jbash@velvet.com
>
295 - Basic spec file
; tested with Red Hat
9.