aboutsummaryrefslogtreecommitdiff
path: root/contrib/tor.spec.in
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-03-02 19:09:30 +0000
committerNick Mathewson <nickm@torproject.org>2004-03-02 19:09:30 +0000
commita1503f667ef8b4eeaab81b0c50f273026ca4474a (patch)
treeac31a100c0afd73f2b2e4c29ba86671f2faf9ae0 /contrib/tor.spec.in
parent4f6cf727b9af6070ed6db02f8be5e17057a04a60 (diff)
downloadtor-a1503f667ef8b4eeaab81b0c50f273026ca4474a.tar
tor-a1503f667ef8b4eeaab81b0c50f273026ca4474a.tar.gz
Integrate jbash's RPM spec into build process. (Requires "rpmbuild" to
build properly. Works fine on redhat 9. YMMV.) svn:r1199
Diffstat (limited to 'contrib/tor.spec.in')
-rw-r--r--contrib/tor.spec.in118
1 files changed, 118 insertions, 0 deletions
diff --git a/contrib/tor.spec.in b/contrib/tor.spec.in
new file mode 100644
index 000000000..d1a8ff27a
--- /dev/null
+++ b/contrib/tor.spec.in
@@ -0,0 +1,118 @@
+%define rellevel 2
+%define relbase std.%{rellevel}
+%define rhrel %([ -f /etc/redhat-release ] && (sed -e 's/^Red Hat Linux release //' -e 's/ .*$//' -e 's/\\./_/g' -e 's/^.*$/.rh&/' < /etc/redhat-release))
+%define blddate %(date -u +"%Y%m%d%H%M")
+%define release %{relbase}%{rhrel}.%{blddate}
+
+%define initdir /etc/rc.d/init.d
+
+Summary: tor: The Onion Router; patent-free Onion Routing
+Name: tor
+Version: @VERSION@
+Vendor: R. Dingledine <arma@seul.org>
+Release: %{release}
+License: BSD-like
+Group: Applications/Internet
+URL: http://freehaven.net/tor
+
+Source0: http://freehaven.net/tor/dist/tor-%{version}.tar.gz
+
+Requires(pre): shadow-utils, /usr/bin/id, /bin/date, /bin/sh
+Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{relbase}-root
+
+%description
+Tor is a system that conceals the sources of TCP connections
+by relaying those connections through multiple independently administered
+forwarding nodes; it is a "cascaded mix" system. Among older systems,
+Tor is most similar to Onion Routing. The basic concept of Tor is also
+similar to that of the Zero Knowledge Freedom system or the Java Anonymous
+Proxy. The "onions" used in Tor are similar in concept to the reply blocks
+used with type I "cypherpunks" anonymous remailers. Feeding phrases
+from this paragraph into search engines should give you more background
+information than you really want.
+
+This package provides the "tor" program, which serves as both a client
+and a relay node. Scripts will automatically create a "tor" user and
+group, set tor up to run as a daemon, and automatically start it at
+installation time.
+
+%prep
+%setup -q
+
+# Patch the startup script to use the right user and group IDs. Force
+# the use of /bin/sh as the shell for the "tor" account.
+ed -s contrib/tor.sh.in << '/EOF/' > /dev/null
+,s/^TORUSER=$/TORUSER=tor/
+,s/^TORGROUP=$/TORGROUP=tor/
+,s:/bin/su:/bin/su -s /bin/sh:
+#
+# Save and exit ed
+w
+q
+/EOF/
+
+%build
+%configure
+%__make
+
+%install
+%makeinstall
+
+# Install init script.
+%__mkdir_p ${RPM_BUILD_ROOT}%{initdir}
+%__install -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{initdir}/tor
+
+# Directories that don't have any preinstalled files
+%__mkdir_p -m 700 ${RPM_BUILD_ROOT}/var/lib/tor
+%__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/run/tor
+%__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/log/tor
+
+%clean
+[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+
+%pre
+[ -f %{initdir}/tor ] && /sbin/service tor stop
+if [ ! -n "`/usr/bin/id -g tor 2>/dev/null`" ]; then
+ # One would like to default the GID, but doing that properly would
+ # require thought.
+ %{_sbindir}/groupadd tor 2> /dev/null
+fi
+if [ ! -n "`/usr/bin/id -u tor 2>/dev/null`" ]; then
+ # One would also like to default the UID, but doing that properly would
+ # also require thought.
+ if [ -x /sbin/nologin ]; then
+ %{_sbindir}/useradd -r -g tor -d / -s /sbin/nologin tor 2> /dev/null
+ else
+ %{_sbindir}/useradd -r -g tor -d / -s /bin/false tor 2> /dev/null
+ fi
+fi
+
+%post
+/sbin/chkconfig --add tor
+/sbin/chkconfig tor && /sbin/service tor start
+
+%preun
+/sbin/chkconfig tor && /sbin/service tor stop
+/sbin/chkconfig --del tor
+
+%files
+%defattr(-,root,root)
+%doc AUTHORS INSTALL LICENSE README
+%{_mandir}/man*/*
+%{_bindir}/tor
+%{_bindir}/torify
+%{initdir}/tor
+%dir %{_sysconfdir}/tor/
+%config(noreplace) %{_sysconfdir}/tor/torrc
+%config(noreplace) %{_sysconfdir}/tor/dirservers
+%config(noreplace) %{_sysconfdir}/tor/tor-tsocks.conf
+%attr(-,tor,tor) %dir /var/lib/tor
+%attr(-,tor,tor) %dir /var/run/tor
+%attr(-,tor,tor) %dir /var/log/tor
+
+%changelog
+* Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
+- Basic spec file; tested with Red Hat 9.
+