[tor/f18] Build with --with-tor-user and --with-tor-group
Jamie Nguyen
jamielinux at fedoraproject.org
Mon Mar 4 23:14:36 UTC 2013
commit 7aa6ac5a7e74ca60152a928e951bc52faf3264f3
Author: Jamie Nguyen <j at jamielinux.com>
Date: Mon Mar 4 22:46:38 2013 +0000
Build with --with-tor-user and --with-tor-group
tor.spec | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/tor.spec b/tor.spec
index 4153a92..c70005d 100644
--- a/tor.spec
+++ b/tor.spec
@@ -1,6 +1,7 @@
%global _hardened_build 1
-%global username toranon
+%global toruser toranon
+%global torgroup toranon
%global homedir %_var/lib/%{name}
%global logdir %_var/log/%{name}
@@ -57,7 +58,7 @@ high-stakes anonymity.
%build
export LDFLAGS='-Wl,--as-needed'
-%configure --with-tor-user=%{username} --with-tor-group=%{username} \
+%configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
--docdir=%{_docdir}/%{name}-%{version}
make %{?_smp_mflags}
@@ -70,7 +71,7 @@ sed -i -e "s|#DataDirectory.*$|DataDirectory %{homedir}/.tor|g" \
$RPM_BUILD_ROOT%{_sysconfdir}/tor/torrc
cat << EOF >> $RPM_BUILD_ROOT%{_sysconfdir}/tor/torrc
Log notice syslog
-User %{username}
+User %{toruser}
EOF
mkdir -p $RPM_BUILD_ROOT%{logdir}
@@ -84,10 +85,10 @@ install -D -p -m 0644 %{SOURCE2} \
%pre
-getent group %username >/dev/null || groupadd -r %username
-getent passwd %username >/dev/null || \
+getent group %{torgroup} >/dev/null || groupadd -r %{torgroup}
+getent passwd %{toruser} >/dev/null || \
useradd -r -s /sbin/nologin -d %{homedir} -M \
- -c 'TOR anonymizing user' -g %{username} %{username}
+ -c 'TOR anonymizing user' -g %{torgroup} %{toruser}
exit 0
%post
@@ -114,9 +115,9 @@ exit 0
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/tor/torrc
%config(noreplace) %{_sysconfdir}/tor/tor-tsocks.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/tor
-%attr(0700,%{username},%{username}) %dir %{homedir}
-%attr(0700,%{username},%{username}) %dir %{logdir}
-%attr(0750,%{username},%{username}) %dir %{_localstatedir}/run/tor
+%attr(0700,%{toruser},%{torgroup}) %dir %{homedir}
+%attr(0700,%{toruser},%{torgroup}) %dir %{logdir}
+%attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/run/tor
%changelog
@@ -152,6 +153,12 @@ exit 0
- after moving the tor-systemd and torify subpackages back into the main tor
package, the %%with_noarch macro and the associated conditionals are no
longer used so remove them
+- split username global variable into separate toruser and torgroup global
+ variables to improve spec flexibility and ease of comprehension, as well
+ as matching how upstream have written their spec
+- use --with-tor-user=%%toruser and --with-tor-group=%%torgroup options when
+ running %%configure, as recommended by upstream
+
More information about the scm-commits
mailing list