File pam-modules.spec of Package pam-modules

#
# spec file for package pam-modules
#
# Copyright (c) 2016 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/
#


%if %{suse_version} >= 1100
%define enable_selinux 1
%else
%define enable_selinux 0
%endif

Name:           pam-modules
Summary:        Additional PAM Modules
License:        BSD-3-Clause and GPL-2.0
Group:          System/Libraries
Version:        12.1
Release:        0
#
Source0:        pam_unix2-2.9.1.tar.bz2
Source1:        pam_pwcheck-3.13.tar.bz2
Source2:        pam_homecheck-2.0.tar.bz2
Source3:        default.passwd
Source6:        baselibs.conf
Source50:       dlopen.sh
Patch0:         0003-use-crypt_gensalt_rn-from-glibc.diff
Patch1:         0004-add-workarounds-for-blowfish-signedness-bug.diff
Patch2:         pam_unix2-glibc216.patch
Patch3:         pam_unix2-selinux.patch
Patch4:         pam-modules-automake.patch
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         permissions
BuildRequires:  cracklib-devel
BuildRequires:  libtool
BuildRequires:  pam-devel
%if %{enable_selinux}
BuildRequires:  libselinux-devel
%endif
BuildRequires:  pkgconfig(libnsl)

%description
PAM (Pluggable Authentication Modules) is a system security tool that
allows system administrators to set authentication policies without
having to recompile programs that do authentication.

This package contains additional, obsolete PAM Modules sometimes
needed for migration: pam_unix2 and pam_pwcheck


%prep
%setup -q -c %{name} -b1 -b2
pushd pam_unix2-*
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
popd
%patch4
%build
pushd pam_unix2-*
gettextize -f
popd
for i in * ; do
  cd $i;
  autoreconf -fiv
  %configure --enable-selinux \
		--libdir=/%{_lib}
  make %{?_smp_mflags}
  cd ..
done

%install
mkdir -p $RPM_BUILD_ROOT/sbin
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}
for i in * ; do
  cd $i;
  make DESTDIR=$RPM_BUILD_ROOT install
  cd ..
done
#
# Remove stuff we don't wish to have now:
#
rm -rf $RPM_BUILD_ROOT/usr/{include,lib}
rm -rf $RPM_BUILD_ROOT/%{_lib}/security/*.la
# Check for module problems.  Specifically, check that every module we just
# installed can actually be loaded by a minimal PAM-aware application.
export CC=%__cc
for module in $RPM_BUILD_ROOT/%{_lib}/security/pam*.so ; do
   if ! sh $RPM_SOURCE_DIR/dlopen.sh -lpam -ldl ${module} ; then
      exit 1
   fi
done
#
# Install READMEs of PAM modules
#
DOC=$RPM_BUILD_ROOT%{_defaultdocdir}/pam
mkdir -p $DOC/modules
for i in pam_*/README ; do
  cp -fpv ${i} $DOC/modules/README.`dirname ${i}`
done
# Replace default/passwd file
install -m 644 %SOURCE3 $RPM_BUILD_ROOT/etc/default/passwd
# Find lang files
%{find_lang} pam_unix2
%{find_lang} pam_pwcheck pam_unix2.lang

%files -f pam_unix2.lang
%defattr(-,root,root,755)
%doc %{_defaultdocdir}/pam
%attr(644,root,root) %config(noreplace) /etc/default/passwd
%attr(755,root,root) /%{_lib}/security/pam_homecheck.so
%attr(755,root,root) /%{_lib}/security/pam_pwcheck.so
%attr(755,root,root) /%{_lib}/security/pam_unix2.so
%attr(644,root,root) %doc %{_mandir}/man8/pam_pwcheck.8.gz
%attr(644,root,root) %doc %{_mandir}/man8/pam_unix2.8.gz

%changelog
openSUSE Build Service is sponsored by