2004-11-04 16:17:22 +01:00
|
|
|
## NOTE: tor.spec is autogenerated from tor.spec.in . Edit the latter,
|
|
|
|
## not the former.
|
|
|
|
|
|
|
|
## Things that need to be edited frequently
|
|
|
|
#
|
|
|
|
# This should be incremented whenever the spec file changes, but
|
|
|
|
# can drop back to zero at a new Tor version
|
|
|
|
|
2005-05-23 09:15:08 +02:00
|
|
|
%define specver 0
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
## Things users may want to change
|
|
|
|
#
|
2005-12-24 05:03:39 +01:00
|
|
|
# User (and group) name under which the Tor daemon runs.
|
2004-11-04 16:17:22 +01:00
|
|
|
|
2005-12-24 05:03:39 +01:00
|
|
|
%define toruser @TORUSER@
|
|
|
|
%define torgroup @TORGROUP@
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
## Version song and dance
|
|
|
|
#
|
|
|
|
# This should be the Tor version number, as it appears on the tarball,
|
|
|
|
# including any "pre<x>" or "rc<y>" suffix. This gets massaged to
|
|
|
|
# create the RPM version number, in a way that depends on the Tor
|
|
|
|
# numbering scheme.
|
2004-11-15 00:18:20 +01:00
|
|
|
%define native_version @VERSION@
|
2004-11-04 16:17:22 +01:00
|
|
|
|
2004-12-18 23:19:32 +01:00
|
|
|
%define version %(echo %{native_version} | sed -e 's/-/./g')
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
## Release and OS identification song and dance
|
|
|
|
#
|
|
|
|
# This identifies the lineage of the spec file. This file is the
|
|
|
|
# standard one that comes with Tor; various distributions may
|
|
|
|
# have their own ideas about the right ways to do things.
|
|
|
|
%define pkgspec tor
|
|
|
|
|
2005-12-24 05:03:39 +01:00
|
|
|
# This spec is intended to build and install on multiple distributions
|
|
|
|
# (someday). Detect the distribution we're building on.
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
%define is_rh %(test -e /etc/redhat-release && echo 1 || echo 0)
|
|
|
|
%define is_fc %(test -e /etc/fedora-release && echo 1 || echo 0)
|
|
|
|
%define is_mdk %(test -e /etc/mandrake-release && echo 1 || echo 0)
|
|
|
|
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
|
|
|
|
|
|
|
|
%if %{is_fc}
|
|
|
|
%define ostag %(sed -e 's/^.*release /fc/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/fedora-release)
|
2004-11-04 16:34:04 +01:00
|
|
|
%else
|
2004-11-04 16:17:22 +01:00
|
|
|
%if %{is_rh}
|
|
|
|
%define ostag %(sed -e 's/^.*release /rh/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/redhat-release)
|
|
|
|
%endif
|
2004-11-04 16:34:04 +01:00
|
|
|
%endif
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
# These are probably wrong... just placeholders should we actually
|
|
|
|
# end up supporting these distributions
|
|
|
|
|
|
|
|
%if %{is_mdk}
|
|
|
|
%define ostag mdk
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{is_suse}
|
|
|
|
%define ostag suse
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Using the build date ensures that every build really does get
|
2004-12-19 00:04:55 +01:00
|
|
|
# a different release number. We use this trick for CVS versions.
|
|
|
|
# For release versions, we don't want or need it.
|
|
|
|
%define is_cvs_version %(echo %{native_version} | grep 'cvs' > /dev/null && echo 1 || echo 0)
|
2004-11-04 16:17:22 +01:00
|
|
|
|
2004-12-19 00:04:55 +01:00
|
|
|
%if %{is_cvs_version}
|
|
|
|
%define blddate %(date -u +"%Y%m%d%H%M")
|
2004-11-04 16:17:22 +01:00
|
|
|
%define release %{pkgspec}.%{specver}.%{ostag}.%{blddate}
|
2004-12-19 00:04:55 +01:00
|
|
|
%else
|
|
|
|
%define release %{pkgspec}.%{specver}.%{ostag}
|
|
|
|
%endif
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
## General-purpose macros
|
|
|
|
#
|
|
|
|
# Some systems don't have some macros. If a macro doesn't seem
|
|
|
|
# to exist on your system, add it here...
|
|
|
|
|
|
|
|
%if %{!?__make:1}%{?__make:0}
|
|
|
|
%define __make make
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{!?make:1}%{?make:0}
|
|
|
|
%define make %{__make}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{!?_localstatedir:1}%{?_localstatedir:0}
|
|
|
|
%define _localstatedir @LOCALSTATEDIR@
|
|
|
|
%endif
|
|
|
|
|
|
|
|
## Package information
|
|
|
|
#
|
|
|
|
Name: tor
|
|
|
|
Version: %{version}
|
|
|
|
Release: %{release}
|
|
|
|
|
|
|
|
Summary: Anonymizing overlay network for TCP (The onion router)
|
2005-01-05 01:06:51 +01:00
|
|
|
URL: http://tor.eff.org/
|
2004-11-04 16:17:22 +01:00
|
|
|
Group: System Environment/Daemons
|
|
|
|
|
|
|
|
License: BSD-like
|
|
|
|
Vendor: R. Dingledine <arma@seul.org>
|
|
|
|
Packager: Nick Mathewson <nickm@seul.org>
|
|
|
|
|
2006-02-09 05:22:25 +01:00
|
|
|
Requires: openssl >= 0.9.6, libevent >= 1.1a
|
2006-02-02 04:21:13 +01:00
|
|
|
BuildRequires: openssl-devel >= 0.9.6, libevent-devel >= 1.1a
|
2005-12-24 05:03:39 +01:00
|
|
|
%if %{is_fc}
|
|
|
|
BuildRequires: rpm-build >= 4.0
|
|
|
|
%endif
|
2005-12-25 17:24:42 +01:00
|
|
|
%if %{is_suse}
|
|
|
|
BuildRequires: rpm >= 4.0, zlib-devel
|
|
|
|
%endif
|
2005-12-24 05:03:39 +01:00
|
|
|
Requires(pre): /usr/bin/id, /bin/date, /bin/sh
|
2004-11-04 16:17:22 +01:00
|
|
|
Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
|
|
|
|
|
2005-01-05 01:06:51 +01:00
|
|
|
Source0: http://tor.eff.org/dist/%{name}-%{native_version}.tar.gz
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
|
|
|
|
|
|
%description
|
|
|
|
Tor is a connection-based low-latency anonymous communication system.
|
|
|
|
|
|
|
|
This package provides the "tor" program, which serves as both a client and
|
2005-12-24 05:03:39 +01:00
|
|
|
a relay node. Scripts will automatically create a "%{toruser}" user and
|
|
|
|
a "%{torgroup}" group, and set tor up to run as a daemon when the system
|
|
|
|
is rebooted.
|
2004-11-04 16:17:22 +01:00
|
|
|
|
2004-12-20 01:59:38 +01:00
|
|
|
Applications connect to the local Tor proxy using the SOCKS
|
|
|
|
protocol. The local proxy chooses a path through a set of relays, in
|
2004-11-04 16:17:22 +01:00
|
|
|
which each relay knows its predecessor and successor, but no
|
|
|
|
others. Traffic flowing down the circuit is unwrapped by a symmetric
|
2004-12-20 01:59:38 +01:00
|
|
|
key at each relay, which reveals the downstream relay.
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
Warnings: Tor does no protocol cleaning. That means there is a danger
|
|
|
|
that application protocols and associated programs can be induced to
|
|
|
|
reveal information about the initiator. Tor depends on Privoxy and
|
|
|
|
similar protocol cleaners to solve this problem. This is alpha code,
|
|
|
|
and is even more likely than released code to have anonymity-spoiling
|
|
|
|
bugs. The present network is very small -- this further reduces the
|
|
|
|
strength of the anonymity provided. Tor is not presently suitable
|
|
|
|
for high-stakes anonymity.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{name}-%{native_version}
|
|
|
|
|
|
|
|
%build
|
2005-12-24 05:03:39 +01:00
|
|
|
%configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup}
|
2004-11-04 16:17:22 +01:00
|
|
|
%make
|
|
|
|
|
|
|
|
%install
|
|
|
|
%makeinstall
|
|
|
|
|
2005-12-24 05:03:39 +01:00
|
|
|
# Install init script and control script
|
2004-11-04 16:17:22 +01:00
|
|
|
%__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir}
|
|
|
|
%__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
|
2005-12-24 05:03:39 +01:00
|
|
|
%__install -p -m 755 contrib/torctl ${RPM_BUILD_ROOT}%{_bindir}
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
# Set up config file; "sample" file implements a basic user node.
|
|
|
|
%__install -p -m 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc
|
|
|
|
|
2005-12-24 05:03:39 +01:00
|
|
|
# Install the logrotate control file.
|
2004-11-04 16:17:22 +01:00
|
|
|
%__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
|
2005-12-24 05:03:39 +01:00
|
|
|
%__install -p -m 644 contrib/tor.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
# Directories that don't have any preinstalled files
|
|
|
|
%__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}
|
|
|
|
%__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}
|
|
|
|
%__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}
|
|
|
|
|
|
|
|
%clean
|
|
|
|
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
|
|
|
|
|
2005-12-24 05:03:39 +01:00
|
|
|
# These scripts are probably wrong for Mandrake or SuSE. They're certainly
|
2004-11-04 16:17:22 +01:00
|
|
|
# wrong for Debian, but what are you doing using RPM on Debian?
|
2005-12-24 05:03:39 +01:00
|
|
|
|
2004-11-04 16:17:22 +01:00
|
|
|
%pre
|
2005-12-24 05:03:39 +01:00
|
|
|
|
|
|
|
# If tor is already installed and running (whether installed by RPM
|
|
|
|
# or not), then kill it, but remember that it was running.
|
|
|
|
%__rm -f /tmp/${name}-was-running-%{version}-%{release}
|
|
|
|
if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then
|
|
|
|
/sbin/service %{name} stop
|
|
|
|
touch /tmp/${name}-was-running-%{version}-%{release}
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create a user and group if need be
|
|
|
|
#
|
|
|
|
if [ ! -n "`/usr/bin/id -g %{torgroup} 2>/dev/null`" ]; then
|
2004-11-04 16:17:22 +01:00
|
|
|
# One would like to default the GID, but doing that properly would
|
|
|
|
# require thought.
|
2005-12-24 05:03:39 +01:00
|
|
|
%{_sbindir}/groupadd %{torgroup} 2> /dev/null
|
2004-11-04 16:17:22 +01:00
|
|
|
fi
|
2005-12-24 05:03:39 +01:00
|
|
|
if [ ! -n "`/usr/bin/id -u %{toruser} 2>/dev/null`" ]; then
|
2004-11-04 16:17:22 +01:00
|
|
|
# One would also like to default the UID, but doing that properly would
|
|
|
|
# also require thought.
|
2005-12-24 05:03:39 +01:00
|
|
|
if [ -x %{_sbindir}/nologin ]; then
|
|
|
|
%{_sbindir}/useradd -r -g %{torgroup} -d% {_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null
|
2004-11-04 16:17:22 +01:00
|
|
|
else
|
2005-12-24 05:03:39 +01:00
|
|
|
%{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev/null
|
2004-11-04 16:17:22 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
%post
|
2005-12-24 05:03:39 +01:00
|
|
|
|
|
|
|
# If this is a new installation, use chkconfig to put tor in the
|
|
|
|
# default set of runlevels. If it's an upgrade, leave the existing
|
|
|
|
# configuration alone.
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
/sbin/chkconfig --add %{name}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Older tor RPMS used a different username for the tor daemon.
|
|
|
|
# Make sure the runtime data have the right ownership.
|
|
|
|
%__chown -R %{toruser}.%{torgroup} %{_localstatedir}/{lib,log,run}/%{name}
|
|
|
|
|
|
|
|
if [ -f /tmp/${name}-was-running-%{version}-%{release} ]; then
|
|
|
|
/sbin/service %{name} start
|
|
|
|
%__rm -f /tmp/${name}-was-running-%{version}-%{release}
|
|
|
|
fi
|
2004-11-04 16:17:22 +01:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
%preun
|
2005-12-24 05:03:39 +01:00
|
|
|
|
|
|
|
# If no instances of tor will be installed when we're done, make
|
|
|
|
# sure that it gets killed. We *don't* want to kill it or delete
|
|
|
|
# any of its data on uninstall if it's being upgraded to a new
|
|
|
|
# version, because the new version will actually already have
|
|
|
|
# been installed and started before the uninstall script for
|
|
|
|
# the old version is run, and we'd end up hosing it.
|
|
|
|
if [ $1 -le 0 ]; then
|
|
|
|
if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then
|
|
|
|
/sbin/service %{name} stop
|
|
|
|
fi
|
|
|
|
%/sbin/chkconfig --del %{name}
|
|
|
|
%__rm -f ${_localstatedir}/lib/%{name}/cached-directory
|
|
|
|
%__rm -f ${_localstatedir}/lib/%{name}/bw_accounting
|
|
|
|
%__rm -f ${_localstatedir}/lib/%{name}/control_auth_cookie
|
|
|
|
%__rm -f ${_localstatedir}/lib/%{name}/router.desc
|
|
|
|
%__rm -f ${_localstatedir}/lib/%{name}/fingerprint
|
|
|
|
fi
|
2004-11-04 16:17:22 +01:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%doc AUTHORS INSTALL LICENSE README ChangeLog doc/HACKING doc/TODO doc/FAQ
|
|
|
|
%{_mandir}/man*/*
|
|
|
|
%{_bindir}/tor
|
2005-12-24 05:03:39 +01:00
|
|
|
%{_bindir}/torctl
|
2004-11-04 16:17:22 +01:00
|
|
|
%{_bindir}/torify
|
|
|
|
%{_bindir}/tor-resolve
|
|
|
|
%config %{_initrddir}/%{name}
|
|
|
|
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
|
2005-12-24 05:03:39 +01:00
|
|
|
%dir %attr(0755,root,%{torgroup}) %{_sysconfdir}/%{name}/
|
|
|
|
%config(noreplace) %attr(0644,root,%{torgroup}) %{_sysconfdir}/%{name}/*
|
|
|
|
%attr(0700,%{toruser},%{torgroup}) %dir %{_localstatedir}/lib/%{name}
|
|
|
|
%attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/run/%{name}
|
|
|
|
%attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name}
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
%changelog
|
2005-12-24 05:03:39 +01:00
|
|
|
|
|
|
|
* Mon Jan 17 2005 John Bashinski <jbash@velvet.com>
|
|
|
|
- Take runtime user and group names from configure system. Default
|
|
|
|
user/group names are now "_tor"; blame Roger...
|
|
|
|
- Make logrotate control file a separate file in the source distribution,
|
|
|
|
rather than creating it from the spec file.
|
|
|
|
- Properly handle the order in which RPM executes scriptlets on upgrade.
|
|
|
|
The old code would kill the daemon on upgrade.
|
|
|
|
- Start the tor daemon after installation if and only if it was
|
|
|
|
running before installation. Preserve runlevel setup on upgrade.
|
|
|
|
- Package the torctl script; the init script is now a wrapper around it.
|
|
|
|
|
2004-11-04 16:17:22 +01:00
|
|
|
* Tue Nov 5 2004 John Bashinski <jbash@velvet.com>
|
|
|
|
- Add skeletal support for multiple distributions
|
|
|
|
- Even more ridiculous level of macro-ization
|
|
|
|
- Modify version numbers so RPM can determine when it has a newer version
|
|
|
|
- Return to including distribution name in package release number
|
|
|
|
- Sharply trim description
|
|
|
|
- Change user/group name from "tor" to "tordmn"; "tor" is a common
|
|
|
|
given name (reported by Marius Hjelle)
|
|
|
|
- Change group to "System Environment/Daemons" (suggested by Marius Hjelle)
|
|
|
|
- Create logrotate file (suggested by Marius Hjelle)
|
|
|
|
- Make Tor run as a user proxy by default (suggested by Marius Hjelle)
|
|
|
|
- Autogenerate spec file from GNU autotools data, substituting version
|
|
|
|
and whatnot
|
|
|
|
- Be perhaps excessively paranoid with config file and directory modes
|
|
|
|
- Remove auto-start and auto-stop at installation time; there's some kind
|
|
|
|
of weird race going on, and it's arguably a bad thing anyway.
|
|
|
|
|
|
|
|
* Mon Jun 06 2004 Nick Mathewson <nickm@freehaven.net> 0.0.7-0.std.0.1.rc2
|
2004-11-10 02:20:17 +01:00
|
|
|
- Make spec file more happy with fc2 packaging
|
2004-11-04 16:17:22 +01:00
|
|
|
|
|
|
|
* Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
|
|
|
|
- Basic spec file; tested with Red Hat 9.
|