From 2c6977cd5fa420504fb313889ac10b157437244f Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Fri, 2 Oct 2015 23:21:02 +0200 Subject: [PATCH] ceph.spec.in: distro-conditional groupadd and useradd The -o option to groupadd/useradd is not recognized in SLE12. For SLE/openSUSE, follow the openSUSE packaging guidelines. Signed-off-by: Nathan Cutler --- ceph.spec.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ceph.spec.in b/ceph.spec.in index faca93115a4..96d715a3f80 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -202,6 +202,9 @@ Requires: python-requests %if 0%{?rhel} || 0%{?fedora} Requires: redhat-lsb-core %endif +%if 0%{?suse_version} +Requires(pre): pwdutils +%endif # python-argparse is only needed in distros with Python 2.6 or lower %if (0%{?rhel} && 0%{?rhel} <= 6) || (0%{?suse_version} && 0%{?suse_version} <= 1110) Requires: python-argparse @@ -875,9 +878,15 @@ CEPH_USER_ID="-u 167" # CEPH_GROUP_ID="-g " # CEPH_USER_ID="-u " # %endif - +%if 0%{?rhel} || 0%{?fedora} %{_sbindir}/groupadd ceph $CEPH_GROUP_ID -o -r 2>/dev/null || : %{_sbindir}/useradd ceph $CEPH_USER_ID -o -r -g ceph -s /sbin/nologin -c "Ceph daemons" -d %{_localstatedir}/lib/ceph 2> /dev/null || : +%endif +%if 0%{?suse_version} +getent group ceph >/dev/null || groupadd -r ceph +getent passwd ceph >/dev/null || useradd -r -g ceph -d %{_localstatedir}/lib/ceph -s /sbin/nologin -c "Ceph daemons" ceph +%endif +exit 0 %post -n ceph-common %if 0%{?_with_systemd}