File libnss_usrfiles.spec of Package libnss_usrfiles

#
# spec file for package libnss_usrfiles
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# We need some private NSS functions
%define __filter_GLIBC_PRIVATE 1
Name:           libnss_usrfiles
Version:        2.25
Release:        0
Summary:        NSS usrfiles plugin for glibc
License:        LGPL-2.1
Group:          System/Base
Url:            http://github.com/thkukuk/libnss_usrfiles
Source:         %{name}-%{version}.tar.bz2
Source1:        baselibs.conf
BuildRequires:  autoconf
BuildRequires:  libtool
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The NSS usrfiles plugin additionally looks in %{_prefix}%{_sysconfdir} for passwd and
group data.

%package -n libnss_usrfiles2
Summary:        NSS usrfiles plugin for glibc
Group:          System/Libraries
# we need cp
Requires(post): coreutils
Requires(post): glibc
Requires(post): sed

%description -n libnss_usrfiles2
The NSS usrfiles plugin looks additional in %{_prefix}%{_sysconfdir} for passwd and
group data.

%prep
%setup -q

%build
%configure --libdir=/%{_lib}
make %{?_smp_mflags}

%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
rm -v %{buildroot}/%{_lib}/%{name}.{a,la,so}
mkdir -p %{buildroot}%{_prefix}/etc

%post -n libnss_usrfiles2
/sbin/ldconfig
cp -a %{_sysconfdir}/nsswitch.conf %{_sysconfdir}/nsswitch.conf.nss_usrfiles
%if 0%{?suse_version} < 1330
sed -i -e 's|^passwd: compat$|passwd: files usrfiles|g' -e 's|^group:  compat$|group:  files usrfiles|g' %{_sysconfdir}/nsswitch.conf
%else
sed -i -e 's|^passwd: compat [NOTFOUND=return] files$|passwd: files usrfiles|g' -e 's|^group:  compat [NOTFOUND=return] files$|group:  files usrfiles|g' %{_sysconfdir}/nsswitch.conf
%endif

%postun -n libnss_usrfiles2 -p /sbin/ldconfig

%files -n libnss_usrfiles2
%defattr(-,root,root)
%doc README.md COPYING
/%{_lib}/libnss_usrfiles.so.2*
%dir %{_prefix}/etc

%changelog
openSUSE Build Service is sponsored by