Do not warn about unknown servers in our family when they are given as hex digests.
[tor.git] / tor.spec.in
blob330093a8367193ee55e0f8736c8f119410c0fe42
1 ## NOTE: tor.spec is autogenerated from tor.spec.in . Edit the latter,
2 ## not the former.
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
9 %define specver 0
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 ## Target a specific arch and OS
20 # default is i386 linux
21 %define target gnu
22 %define target_cpu i386
23 %define target_os linux
25 ## Version song and dance
27 # This should be the Tor version number, as it appears on the tarball,
28 # including any "pre<x>" or "rc<y>" suffix. This gets massaged to
29 # create the RPM version number, in a way that depends on the Tor
30 # numbering scheme.
31 %define native_version @VERSION@
33 %define version %(echo %{native_version} | sed -e 's/-/./g')
35 ## Define output filename
37 # This creates filenames based upon the value of target_cpu defined above
38 %define _build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%{target_cpu}.rpm
40 ## Release and OS identification song and dance
42 # This identifies the lineage of the spec file. This file is the
43 # standard one that comes with Tor; various distributions may
44 # have their own ideas about the right ways to do things.
45 %define pkgspec tor
47 # This spec is intended to build and install on multiple distributions
48 # (someday). Detect the distribution we're building on.
50 %define is_rh %(test -e /etc/redhat-release && echo 1 || echo 0)
51 %define is_fc %(test -e /etc/fedora-release && echo 1 || echo 0)
52 %define is_mdk %(test -e /etc/mandrake-release && echo 1 || echo 0)
53 %define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
55 %if %{is_fc}
56 %define ostag %(sed -e 's/^.*release /fc/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/fedora-release)
57 %else
58 %if %{is_rh}
59 %define ostag %(sed -e 's/^.*release /rh/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/redhat-release)
60 %endif
61 %endif
63 # These are probably wrong... just placeholders should we actually
64 # end up supporting these distributions
66 %if %{is_mdk}
67 %define ostag mdk
68 %endif
70 %if %{is_suse}
71 %define ostag suse
72 %endif
74 # Using the build date ensures that every build really does get
75 # a different release number. We use this trick for CVS versions.
76 # For release versions, we don't want or need it.
77 %define is_cvs_version %(echo %{native_version} | grep 'cvs' > /dev/null && echo 1 || echo 0)
79 %if %{is_cvs_version}
80 %define blddate %(date -u +"%Y%m%d%H%M")
81 %define release %{pkgspec}.%{specver}.%{ostag}.%{blddate}
82 %else
83 %define release %{pkgspec}.%{specver}.%{ostag}
84 %endif
86 ## General-purpose macros
88 # Some systems don't have some macros. If a macro doesn't seem
89 # to exist on your system, add it here...
91 %if %{!?__make:1}%{?__make:0}
92 %define __make make
93 %endif
95 %if %{!?make:1}%{?make:0}
96 %define make %{__make}
97 %endif
99 %if %{!?_localstatedir:1}%{?_localstatedir:0}
100 %define _localstatedir @LOCALSTATEDIR@
101 %endif
103 ## Package information
105 Name: tor
106 Version: %{version}
107 Release: %{release}
109 Summary: Anonymizing overlay network for TCP (The onion router)
110 URL: http://tor.eff.org/
111 Group: System Environment/Daemons
113 License: BSD-like
114 Vendor: R. Dingledine <arma@seul.org>
115 Packager: Nick Mathewson <nickm@seul.org>
117 Requires: openssl >= 0.9.6, libevent >= 1.1a
118 BuildRequires: openssl-devel >= 0.9.6, libevent-devel >= 1.1a
119 %if %{is_fc}
120 BuildRequires: rpm-build >= 4.0
121 %endif
122 %if %{is_suse}
123 BuildRequires: rpm >= 4.0, zlib-devel
124 %endif
125 Requires(pre): /usr/bin/id, /bin/date, /bin/sh
126 Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
128 Source0: http://tor.eff.org/dist/%{name}-%{native_version}.tar.gz
130 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
132 %description
133 Tor is a connection-based low-latency anonymous communication system.
135 This package provides the "tor" program, which serves as both a client and
136 a relay node. Scripts will automatically create a "%{toruser}" user and
137 a "%{torgroup}" group, and set tor up to run as a daemon when the system
138 is rebooted.
140 Applications connect to the local Tor proxy using the SOCKS
141 protocol. The local proxy chooses a path through a set of relays, in
142 which each relay knows its predecessor and successor, but no
143 others. Traffic flowing down the circuit is unwrapped by a symmetric
144 key at each relay, which reveals the downstream relay.
146 Warnings: Tor does no protocol cleaning. That means there is a danger
147 that application protocols and associated programs can be induced to
148 reveal information about the initiator. Tor depends on Privoxy and
149 similar protocol cleaners to solve this problem. This is alpha code,
150 and is even more likely than released code to have anonymity-spoiling
151 bugs. The present network is very small -- this further reduces the
152 strength of the anonymity provided. Tor is not presently suitable
153 for high-stakes anonymity.
155 %prep
156 %setup -q -n %{name}-%{native_version}
158 %build
159 %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
160 --build=%{target_cpu}-pc-%{target_os}-%{target} \
161 --host=%{target_cpu}-pc-%{target_os}-%{target} \
162 --target=%{target_cpu}-pc-%{target_os}-%{target}
163 %make
165 %install
166 %makeinstall
168 # Install init script and control script
169 %__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir}
170 %__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
171 %__install -p -m 755 contrib/torctl ${RPM_BUILD_ROOT}%{_bindir}
173 # Set up config file; "sample" file implements a basic user node.
174 %__install -p -m 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc
176 # Install the logrotate control file.
177 %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
178 %__install -p -m 644 contrib/tor.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
180 # Directories that don't have any preinstalled files
181 %__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}
182 %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}
183 %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}
185 %clean
186 [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
188 # These scripts are probably wrong for Mandrake or SuSE. They're certainly
189 # wrong for Debian, but what are you doing using RPM on Debian?
191 %pre
193 # If tor is already installed and running (whether installed by RPM
194 # or not), then kill it, but remember that it was running.
195 %__rm -f /tmp/${name}-was-running-%{version}-%{release}
196 if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then
197 /sbin/service %{name} stop
198 touch /tmp/${name}-was-running-%{version}-%{release}
202 # Create a user and group if need be
204 if [ ! -n "`/usr/bin/id -g %{torgroup} 2>/dev/null`" ]; then
205 # One would like to default the GID, but doing that properly would
206 # require thought.
207 %{_sbindir}/groupadd %{torgroup} 2> /dev/null
209 if [ ! -n "`/usr/bin/id -u %{toruser} 2>/dev/null`" ]; then
210 # One would also like to default the UID, but doing that properly would
211 # also require thought.
212 if [ -x %{_sbindir}/nologin ]; then
213 %{_sbindir}/useradd -r -g %{torgroup} -d% {_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null
214 else
215 %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev/null
218 exit 0
220 %post
222 # If this is a new installation, use chkconfig to put tor in the
223 # default set of runlevels. If it's an upgrade, leave the existing
224 # configuration alone.
225 if [ $1 -eq 1 ]; then
226 /sbin/chkconfig --add %{name}
229 # Older tor RPMS used a different username for the tor daemon.
230 # Make sure the runtime data have the right ownership.
231 %__chown -R %{toruser}.%{torgroup} %{_localstatedir}/{lib,log,run}/%{name}
233 if [ -f /tmp/${name}-was-running-%{version}-%{release} ]; then
234 /sbin/service %{name} start
235 %__rm -f /tmp/${name}-was-running-%{version}-%{release}
237 exit 0
239 %preun
241 # If no instances of tor will be installed when we're done, make
242 # sure that it gets killed. We *don't* want to kill it or delete
243 # any of its data on uninstall if it's being upgraded to a new
244 # version, because the new version will actually already have
245 # been installed and started before the uninstall script for
246 # the old version is run, and we'd end up hosing it.
247 if [ $1 -le 0 ]; then
248 if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then
249 /sbin/service %{name} stop
251 %/sbin/chkconfig --del %{name}
252 %__rm -f ${_localstatedir}/lib/%{name}/cached-directory
253 %__rm -f ${_localstatedir}/lib/%{name}/bw_accounting
254 %__rm -f ${_localstatedir}/lib/%{name}/control_auth_cookie
255 %__rm -f ${_localstatedir}/lib/%{name}/router.desc
256 %__rm -f ${_localstatedir}/lib/%{name}/fingerprint
258 exit 0
260 %files
261 %defattr(-,root,root)
262 %doc AUTHORS INSTALL LICENSE README ChangeLog doc/HACKING doc/TODO
263 %{_mandir}/man*/*
264 %{_bindir}/tor
265 %{_bindir}/torctl
266 %{_bindir}/torify
267 %{_bindir}/tor-resolve
268 %config %{_initrddir}/%{name}
269 %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
270 %dir %attr(0755,root,%{torgroup}) %{_sysconfdir}/%{name}/
271 %config(noreplace) %attr(0644,root,%{torgroup}) %{_sysconfdir}/%{name}/*
272 %attr(0700,%{toruser},%{torgroup}) %dir %{_localstatedir}/lib/%{name}
273 %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/run/%{name}
274 %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name}
276 %changelog
278 * Mon Jan 17 2005 John Bashinski <jbash@velvet.com>
279 - Take runtime user and group names from configure system. Default
280 user/group names are now "_tor"; blame Roger...
281 - Make logrotate control file a separate file in the source distribution,
282 rather than creating it from the spec file.
283 - Properly handle the order in which RPM executes scriptlets on upgrade.
284 The old code would kill the daemon on upgrade.
285 - Start the tor daemon after installation if and only if it was
286 running before installation. Preserve runlevel setup on upgrade.
287 - Package the torctl script; the init script is now a wrapper around it.
289 * Tue Nov 5 2004 John Bashinski <jbash@velvet.com>
290 - Add skeletal support for multiple distributions
291 - Even more ridiculous level of macro-ization
292 - Modify version numbers so RPM can determine when it has a newer version
293 - Return to including distribution name in package release number
294 - Sharply trim description
295 - Change user/group name from "tor" to "tordmn"; "tor" is a common
296 given name (reported by Marius Hjelle)
297 - Change group to "System Environment/Daemons" (suggested by Marius Hjelle)
298 - Create logrotate file (suggested by Marius Hjelle)
299 - Make Tor run as a user proxy by default (suggested by Marius Hjelle)
300 - Autogenerate spec file from GNU autotools data, substituting version
301 and whatnot
302 - Be perhaps excessively paranoid with config file and directory modes
303 - Remove auto-start and auto-stop at installation time; there's some kind
304 of weird race going on, and it's arguably a bad thing anyway.
306 * Mon Jun 06 2004 Nick Mathewson <nickm@freehaven.net> 0.0.7-0.std.0.1.rc2
307 - Make spec file more happy with fc2 packaging
309 * Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
310 - Basic spec file; tested with Red Hat 9.