[tor/f18] Remove dependency on fedora-usermgmt

Jamie Nguyen jamielinux at fedoraproject.org
Mon Mar 4 23:14:01 UTC 2013


commit c10c743b61b97bf47b45ad8ab3648d99587baf2b
Author: Jamie Nguyen <j at jamielinux.com>
Date:   Mon Mar 4 22:26:07 2013 +0000

    Remove dependency on fedora-usermgmt

 tor.spec |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/tor.spec b/tor.spec
index 5ca4751..ce1a166 100644
--- a/tor.spec
+++ b/tor.spec
@@ -1,12 +1,10 @@
 ## This package understands the following switches:
-%bcond_without      fedora
 %bcond_without      noarch
 %bcond_with         upstart
 
 %global _hardened_build 1
 
 %global username    toranon
-%global uid         19
 %global homedir     %_var/lib/%{name}
 %global logdir      %_var/log/%{name}
 
@@ -32,11 +30,8 @@ Source2:        tor.logrotate
 Obsoletes:      tor-doc < 0.2.2
 
 BuildRequires:  libevent-devel openssl-devel asciidoc
-BuildRequires:  fedora-usermgmt-devel
-Provides:       user(%{username})  = %uid
-Provides:       group(%{username}) = %uid
 Requires:       init(%{name})
-%{?FE_USERADD_REQ}
+Requires(pre):  shadow-utils
 
 
 %package -n torify
@@ -158,14 +153,11 @@ mv _doc/torify.html _doc-torify
 
 
 %pre core
-%__fe_groupadd %uid -r %{username} &>/dev/null || :
-%__fe_useradd  %uid -r -s /sbin/nologin -d %{homedir} -M \
-                    -c 'TOR anonymizing user' \
-                    -g %{username} %{username} &>/dev/null || :
-
-%postun core
-%__fe_userdel  %{username} &>/dev/null || :
-%__fe_groupdel %{username} &>/dev/null || :
+getent group %username >/dev/null || groupadd -r %username
+getent passwd %username >/dev/null || \
+    useradd -r -s /sbin/nologin -d %{homedir} -M \
+    -c 'TOR anonymizing user' -g %{username} %{username}
+exit 0
 
 %post systemd
 %systemd_post %{name}.service
@@ -233,6 +225,13 @@ test "$1" != "0" || /sbin/initctl -q stop tor || :
   /var/log/tor should be owned by toranon:toranon with 0700 permissions;
   /var/lib/tor should be owned by toranon:toranon with 0700 permissions;
   /etc/tor/torrc should be owned by root:root with 0644 permissions;
+- remove dependency on fedora-usermgmt as it has been queued for obsoletion
+  from Fedora
+- add users and groups without forcing use of uid=19 as it is not necessarily
+  available, nor is it required or expected by upstream
+- do not remove users/groups in %%postun as the guidelines state:
+  https://fedoraproject.org/wiki/Packaging:UsersAndGroups
+
 
 * Thu Feb 07 2013 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.2.3.25-1801
 - torify subpackage should depend on torsocks not tsocks (#908569)


More information about the scm-commits mailing list