123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- %define specver 0
- %define toruser @TORUSER@
- %define torgroup @TORGROUP@
- %define target gnu
- %define target_cpu i386
- %define target_os linux
- %define _arch %{target_cpu}
- %define _build_arch %{target_cpu}
- %define _vendor %{target_os}
- %define _host %{target_cpu}-pc-%{target_os}-%{target}
- %define _host_cpu %{target_cpu}
- %define _host_vendor %{target_os}
- %define optflags -march=%{target_cpu} -mtune=%{target_cpu} -O2
- %define native_version @VERSION@
- %define version %(echo %{native_version} | sed -e 's/-/./g')
- %define _build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%{target_cpu}.rpm
- %define pkgspec tor
- %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)
- %else
- %if %{is_rh}
- %define ostag %(sed -e 's/^.*release /rh/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/redhat-release)
- %endif
- %endif
- %if %{is_mdk}
- %define ostag mdk
- %endif
- %if %{is_suse}
- %define ostag suse
- %endif
- %define is_dev_version %(echo %{native_version} | grep 'dev' > /dev/null && echo 1 || echo 0)
- %if %{is_dev_version}
- %define blddate %(date -u +"%Y%m%d%H%M")
- %define release %{pkgspec}.%{specver}.%{ostag}.%{blddate}
- %else
- %define release %{pkgspec}.%{specver}.%{ostag}
- %endif
- %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
- Name: tor
- Version: %{version}
- Release: %{release}
- Summary: Anonymizing overlay network for TCP (The onion router)
- URL: https://www.torproject.org/
- Group: System Environment/Daemons
- License: BSD-like
- Vendor: R. Dingledine <arma@seul.org>
- Packager: Andrew Lewman <phobos@rootme.org>
- %if %{is_suse}
- Requires: openssl >= 0.9.6
- BuildRequires: openssl-devel >= 0.9.6, rpm >= 4.0, zlib-devel
- %else
- Requires: openssl >= 0.9.6
- BuildRequires: openssl-devel >= 0.9.6, libevent-devel >= 1.1a
- %endif
- %if %{is_fc}
- BuildRequires: rpm-build >= 4.0
- %endif
- Requires(pre): /usr/bin/id, /bin/date, /bin/sh
- Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
- Source0: https://www.torproject.org/dist/%{name}-%{native_version}.tar.gz
- 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
- 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.
- Applications connect to the local Tor proxy using the SOCKS
- protocol. The local proxy chooses a path through a set of relays, in
- which each relay knows its predecessor and successor, but no
- others. Traffic flowing down the circuit is unwrapped by a symmetric
- key at each relay, which reveals the downstream relay.
- 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
- %if %{is_suse}
- %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
- --build=%{_host} --host=%{_host} --target=%{_host}
- %else
- %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
- --build=%{_host} --host=%{_host} --target=%{_host}
- %endif
- %make
- %install
- %makeinstall
- %__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir}
- %if %{is_suse}
- %__install -p -m 755 contrib/suse/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
- %else
- %__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
- %endif
- %__install -p -m 755 contrib/torctl ${RPM_BUILD_ROOT}%{_bindir}
- %__install -p -m 644 src/config/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc.sample
- %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
- %__install -p -m 644 contrib/tor.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
- %__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}
- %__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/tmp/%{name}
- %clean
- [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
- %pre
- %__rm -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release}
- if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then
- /sbin/service %{name} stop
- touch /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release}
- fi
- if [ ! -n "`/usr/bin/id -g %{torgroup} 2>/dev/null`" ]; then
-
-
- %{_sbindir}/groupadd %{torgroup} 2> /dev/null
- fi
- if [ ! -n "`/usr/bin/id -u %{toruser} 2>/dev/null`" ]; then
-
-
- if [ -x %{_sbindir}/nologin ]; then
- %{_sbindir}/useradd -r -g %{torgroup} -d% {_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null
- else
- %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev/null
- fi
- fi
- exit 0
- %post
- if [ $1 -eq 1 ]; then
- /sbin/chkconfig --add %{name}
- /sbin/chkconfig %{name} on
- fi
- %__chown -R %{toruser}.%{torgroup} %{_localstatedir}/{lib,log,run}/%{name}
- if [ -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release} ]; then
- /sbin/service %{name} start
- %__rm -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release}
- fi
- exit 0
- %preun
- 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
- exit 0
- %files
- %defattr(-,root,root)
- %doc AUTHORS INSTALL LICENSE README ChangeLog doc/HACKING doc/TODO
- %{_mandir}/man*/*
- %{_bindir}/tor
- %{_bindir}/torctl
- %{_bindir}/torify
- %{_bindir}/tor-resolve
- %{_bindir}/tor-gencert
- %config %{_initrddir}/%{name}
- %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
- %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}
- %changelog
- * Tue Feb 27 2007 Andrew Lewman <phobos@rootme.org>
- - Fix a potential race condition in how we determine the running state of tor. Found by Stefan Nordhausen.
- - see OR-CVS for details
- * Fri May 26 2006 Andrew Lewman <phobos@rootme.org>
- - Add in a few "SUSEisms" to make dist-rpm actually work on suse
- - Turn Tor "on" via chkconfig
- - Update -mcpu to -mtune to make GCC happy
- - see OR-CVS for details
- * Tue Mar 28 2006 Andrew Lewman <phobos@rootme.org>
- - converted to build the specified target cpu and arch
- - override related rpm macros to build correctly
- - see OR-CVS for details
- * 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.
- * 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
- - Make spec file more happy with fc2 packaging
- * Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
- - Basic spec file; tested with Red Hat 9.
|