1 |
%define toruser toruser |
2 |
%define torgroup toruser |
3 |
|
4 |
#comment out if not rc |
5 |
#define prel rc |
6 |
|
7 |
%define rel 1 |
8 |
|
9 |
Name: tor |
10 |
# |
11 |
# Please stay at 0.3.5.x LTS branch! |
12 |
# |
13 |
Version: 0.3.5.15 |
14 |
Release: %mkrel %{?prel:%prel.}%{rel} |
15 |
Summary: Anonymizing overlay network for TCP (The onion router) |
16 |
URL: http://www.torproject.org/ |
17 |
Group: Networking/Other |
18 |
License: BSD-like |
19 |
Source0: http://www.torproject.org/dist/%{name}-%{version}%{?prel:-%prel}.tar.gz |
20 |
Source2: tor.logrotate |
21 |
Source3: tor.defaults-torrc |
22 |
Source4: tor.tmpfiles.d |
23 |
Source10: tor.service |
24 |
Source11: tor@.service |
25 |
Source12: tor-master.service |
26 |
Source20: README |
27 |
|
28 |
# Patch from Fedora: |
29 |
Patch0: tor-0.2.7.6-torrc-ControlSocket-and-CookieAuthFile.patch |
30 |
|
31 |
BuildRequires: pkgconfig(openssl) >= 1.0.1 |
32 |
BuildRequires: pkgconfig(libevent) >= 2.0.10 |
33 |
BuildRequires: pkgconfig(zlib) >= 1.2 |
34 |
BuildRequires: autoconf2.5 |
35 |
BuildRequires: asciidoc |
36 |
BuildRequires: pkgconfig(systemd) |
37 |
Requires(post): systemd >= %{systemd_required_version} |
38 |
Requires(post): rpm-helper >= 0.24.8-1 |
39 |
Requires(preun):rpm-helper >= 0.24.8-1 |
40 |
Requires: openssl >= 0.9.8 |
41 |
Requires: tsocks |
42 |
|
43 |
%description |
44 |
The Tor network is a group of volunteer-operated servers that allows people to |
45 |
improve their privacy and security on the Internet. Tor's users employ this |
46 |
network by connecting through a series of virtual tunnels rather than making a |
47 |
direct connection, thus allowing both organizations and individuals to share |
48 |
information over public networks without compromising their privacy. Along the |
49 |
same line, Tor is an effective censorship circumvention tool, allowing its |
50 |
users to reach otherwise blocked destinations or content. Tor can also be used |
51 |
as a building block for software developers to create new communication tools |
52 |
with built-in privacy features. |
53 |
|
54 |
This package contains the Tor software that can act as either a server on the |
55 |
Tor network, or as a client to connect to the Tor network. |
56 |
|
57 |
%prep |
58 |
%autosetup -n %{name}-%{version}%{?prel:-%prel} -p1 |
59 |
|
60 |
%build |
61 |
%configure \ |
62 |
--with-tor-user=%{toruser} \ |
63 |
--with-tor-group=%{torgroup} \ |
64 |
--enable-systemd |
65 |
%make_build |
66 |
|
67 |
%install |
68 |
%make_install |
69 |
|
70 |
# config file |
71 |
install -D -p -m 644 %{SOURCE3} %{buildroot}%{_datadir}/tor/defaults-torrc |
72 |
mv %{buildroot}%{_sysconfdir}/%{name}/torrc.sample \ |
73 |
%{buildroot}%{_sysconfdir}/%{name}/torrc |
74 |
|
75 |
# README |
76 |
install -D -p -m 644 %{SOURCE20} %{buildroot}%{_sysconfdir}/tor/README |
77 |
|
78 |
# logrotate config |
79 |
install -D -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/tor |
80 |
|
81 |
# needed directories |
82 |
mkdir -p -m 750 %{buildroot}%{_localstatedir}/lib/tor |
83 |
mkdir -p -m 750 %{buildroot}%{_logdir}/tor |
84 |
|
85 |
# Bash completion |
86 |
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d |
87 |
echo 'complete -F _command $filenames torify' > %{buildroot}%{_sysconfdir}/bash_completion.d/tor |
88 |
|
89 |
# Systemd support |
90 |
install -D -p -m 644 %{SOURCE10} %{buildroot}%_unitdir/tor.service |
91 |
install -D -p -m 644 %{SOURCE11} %{buildroot}%_unitdir/tor@.service |
92 |
install -D -p -m 644 %{SOURCE12} %{buildroot}%_unitdir/tor-master.service |
93 |
install -D -p -m 644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/tor.conf |
94 |
|
95 |
# Some mga specific changes |
96 |
sed \ |
97 |
-i %{buildroot}%{_sysconfdir}/tor/README \ |
98 |
-i %{buildroot}%{_datadir}/tor/defaults-torrc \ |
99 |
-i %{buildroot}%{_sysconfdir}/logrotate.d/tor \ |
100 |
-i %{buildroot}%{_tmpfilesdir}/tor.conf \ |
101 |
-e 's|toranon|%{toruser}|g' |
102 |
|
103 |
# Handle docs in files section |
104 |
rm -rf %{buildroot}%{_docdir}/ |
105 |
|
106 |
%pre |
107 |
%_pre_useradd %{toruser} %{_localstatedir}/lib/%{name} /bin/false |
108 |
|
109 |
%post |
110 |
%_tmpfilescreate %{name} |
111 |
%_post_service %{name} |
112 |
|
113 |
%preun |
114 |
%_preun_service %{name} |
115 |
%_preun_service %{name}-master |
116 |
|
117 |
if [ $1 -eq 0 ]; then |
118 |
rm -fR %{_localstatedir}/lib/%{name}/* |
119 |
fi |
120 |
|
121 |
%postun |
122 |
if [ $1 -ge 1 ]; then |
123 |
# Use restart instead of try-restart, as tor-master may be "inactive" even |
124 |
# when there are tor.service and tor@.service instances running. |
125 |
systemctl restart tor-master.service >/dev/null 2>&1 || : |
126 |
fi |
127 |
|
128 |
%files |
129 |
%doc README ChangeLog ReleaseNotes doc/HACKING doc/*.html |
130 |
%license LICENSE |
131 |
%{_bindir}/tor |
132 |
%{_bindir}/tor-gencert |
133 |
%{_bindir}/tor-print-ed-signing-cert |
134 |
%{_bindir}/tor-resolve |
135 |
%{_bindir}/torify |
136 |
%{_mandir}/man1/tor.1* |
137 |
%{_mandir}/man1/tor-gencert.1* |
138 |
%{_mandir}/man1/tor-print-ed-signing-cert.1* |
139 |
%{_mandir}/man1/tor-resolve.1* |
140 |
%{_mandir}/man1/torify.1* |
141 |
%dir %{_datadir}/tor |
142 |
%{_datadir}/tor/defaults-torrc |
143 |
%{_datadir}/tor/geoip |
144 |
%{_datadir}/tor/geoip6 |
145 |
%{_tmpfilesdir}/tor.conf |
146 |
%{_unitdir}/tor.service |
147 |
%{_unitdir}/tor@.service |
148 |
%{_unitdir}/tor-master.service |
149 |
|
150 |
%dir %{_sysconfdir}/tor |
151 |
%{_sysconfdir}/tor/README |
152 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/tor/torrc |
153 |
%config(noreplace) %{_sysconfdir}/logrotate.d/tor |
154 |
|
155 |
%attr(0750,%{toruser},root) %dir %dir %{_localstatedir}/lib/tor |
156 |
%attr(0750,%{toruser},%{torgroup}) %dir %{_logdir}/tor |
157 |
|
158 |
%{_sysconfdir}/bash_completion.d/tor |