File project.diff of Package nss_db
--- nss_db.spec.orig
+++ nss_db.spec
@@ -1,28 +1,39 @@
#
-# spec file for package nss_db (Version 2.1.92)
+# spec file for package nss_db (Version 2.1.93)
#
-# Copyright (c) 2004 SUSE LINUX AG, Nuernberg, Germany.
-# This file and all modifications and additions to the pristine
-# package are under the same license as the package itself.
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
-# Please submit bugfixes or comments via http://www.suse.de/feedback/
+# 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/
#
+# norootforbuild
+
#usedforbuild aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cracklib cvs cyrus-sasl diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv less libacl libattr libgcc libstdc++ libxcrypt m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-modules patch permissions popt procinfo procps psmisc pwdutils rcs readline sed strace sysvinit tar tcpd texinfo timezone unzip util-linux vim zlib zlib-devel autoconf automake binutils gcc gdbm gettext libtool perl rpm
Name: nss_db
-BuildRequires: syslogd kbd devs db db-devel
-Prefix: %{_prefix}
License: GPL, LGPL
Group: Productivity/Networking/Other
Autoreqprov: on
Version: 2.2
-Release: 1
-Summary: NSS library for DB
+Release: 14.7
+Summary: NSS library for Berkeley DB
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source: %{name}-%{version}.tar.gz
-Patch: nss_db-2.2.diff
-URL: http://members1.chello.nl/~mmkettenis/
+Source: nss_db-%{version}.tar.bz2
+Patch1: nss_db-2.2-update-2.patch
+Patch2: nss_db-2.2-db-Makefile.in.patch
+
+BuildRequires: kbd db db-devel
+
+URL: http://www.padl.com/
%description
This package contains nss_db, which is a set of C library extensions
@@ -31,35 +42,138 @@ aliases, ethers, groups, networks, proto
shadow passwords (instead of or in addition to using flat files or
NIS).
-
+%define _localstatedir /var/cache/nss_db
%prep
-%setup
-%patch
+%setup -q -n nss_db-%{version}
+
+# update patch from http://www.linuxfromscratch.org/patches/downloads/nss_db/nss_db-2.2-update-2.patch
+%patch1 -p1
+
+# db-Makefile.in patch
+%patch2
+rm db-Makefile
+
+#remove config.sub, because its to old. install a new one with automake
+rm config.sub
%build
-autoreconf --force --install
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix}
+aclocal
+automake -a
+libtoolize -f
+autoconf
+#autoreconf --force --install
+
+CFLAGS="$RPM_OPT_FLAGS" \
+CPPFLAGS="" \
+./configure --prefix=%{_prefix} --libdir=/%{_lib} --localstatedir=%{_localstatedir} --build %{_target}
make
%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/%{_lib} $RPM_BUILD_ROOT/var/db $RPM_BUILD_ROOT/%{_bindir}
-cp -a .libs/libnss_db.so.2* $RPM_BUILD_ROOT/%{_lib}/
-cp -a db-Makefile $RPM_BUILD_ROOT/var/db/Makefile
-install -m 755 makedb $RPM_BUILD_ROOT/%{_bindir}
+mkdir $RPM_BUILD_ROOT/{%{_lib},%{_usr},%{_bindir},%{_libdir}}
+#make install DESTDIR=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/%{_localstatedir}
+install -m 755 .libs/libnss_db.so.2.0.0 $RPM_BUILD_ROOT/%{_lib}/libnss_db-%{version}.so.2
+install -m 644 db-Makefile $RPM_BUILD_ROOT/%{_localstatedir}/Makefile
+install -m 755 makedb $RPM_BUILD_ROOT/%{_bindir}/
+
+# create symbolic links under /usr/lib or /usr/lib64
+for file in $RPM_BUILD_ROOT/%{_lib}/*; do ln -sf /%{_lib}/${file/*\/} $RPM_BUILD_ROOT%{_libdir}/${file/*\/}; done
+
+# create dummy files for rpm
+touch $RPM_BUILD_ROOT/%{_localstatedir}/{passwd,group,services,hosts}.db
%clean
-rm -rf $RPM_BUILD_ROOT
+make clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%post
+# tell apparmor if installed that nscd is allowed to access /var/db, or wathever your _localstatedir points to
+if [ -f /etc/apparmor.d/abstractions/nameservice ] && [ -z "$(grep "%{_localstatedir}/{passwd," /etc/apparmor.d/abstractions/nameservice)" ]; then
+ echo "# make nss_db database readable by nscd" >> /etc/apparmor.d/abstractions/nameservice
+ echo "%{_localstatedir}/{passwd,group,services,hosts}.db r," >> /etc/apparmor.d/abstractions/nameservice
+ rcapparmor reload
+fi
+
+#modify nssswitch.conf
+sed -ie 's/^\(\(passwd\|group\|shadow\):.*\)\( db\)/\1/;s/^\(\(passwd\|group\|shadow\):.*\)/\1 db/' /etc/nsswitch.conf
+
+echo "Offline authentication is only possible if you install pam_ccreds too."
+
+%postun
+# tell apparmor if installed that nscd is allowed to access /var/db, or wathever your _localstatedir points to
+if [ -f /etc/apparmor.d/abstractions/nameservice ] && [ ! -z "$(grep "%{_localstatedir}/{passwd," /etc/apparmor.d/abstractions/nameservice)" ]; then
+ sed -i -e "s@# make nss_db database readable by nscd@@" /etc/apparmor.d/abstractions/nameservice
+ sed -i -e "s@%{_localstatedir}/{passwd,group,services,hosts}.db r,@@" /etc/apparmor.d/abstractions/nameservice
+ rcapparmor reload
+fi
+
+#modify nssswitch.conf
+sed -ie "s/^\(\(passwd\|group\|shadow\):[^\[]*\)\(\[NOTFOUND=return\] \)\?db/\1/" /etc/nsswitch.conf
+
%files
%defattr(-,root,root)
-/%{_lib}/libnss_db.so.2*
%{_bindir}/makedb
-%dir /var/db
-/var/db/Makefile
+%dir %{_localstatedir}
+%ghost %{_localstatedir}/*.db
+%{_localstatedir}/Makefile
+%doc INSTALL README
+
+
+
+%package -n libnss_db2
+Group: Productivity/Networking/Other
+Summary: Binaries like makedb
+
+%description -n libnss_db2
+This package contains nss_db, which is a set of C library extensions
+which allow Berkeley Databases to be used as a primary source of
+aliases, ethers, groups, networks, protocol, passwd, services and
+shadow passwords (instead of or in addition to using flat files or
+NIS).
+
+
+%files -n libnss_db2
+%defattr(-,root,root)
+/%{_lib}/libnss_db-%{version}.so.2
+%{_libdir}/libnss_db-%{version}.so.2
+
+%post -n libnss_db2
+ldconfig
+
+%postun -n libnss_db2
+ldconfig
+
+
+
+# remove devel package, because .la file throws packaging error; I dont know how to fix it.
+#%package devel
+#Group: Productivity/Networking/Other
+#Summary: Development libary files
+#
+#%description devel
+#Files used for development
+#
+#%files devel
+#/%{_lib}/libnss_db.la
+#/%{_lib}/libnss_db.so
+#%{_libdir}/libnss_db.la
+#/%{_libdir}/libnss_db.so
%changelog -n nss_db
+* Fri Sep 19 2009 - zimmerschied@aiges.de
+- modify nssswitch.conf
+- added ghost files to the rpm
+* Tue Sep 10 2009 - zimmerschied@aiges.de
+- moved shared libaries to a single package libnss_db2 due library packaging policy
+ http://en.opensuse.org/Shared_Library_Packaging_Policy
+- move /var/db to new location /var/cache/nss_db
+* Wed Sep 09 2009 - zimmerschied@aiges.de
+- added update patch from Randy McMurchy <randy_at_linuxfromscratch_dot_org>
+ http://www.linuxfromscratch.org/patches/downloads/nss_db/nss_db-2.2-update-2.patch
+- fixes for 64bit and 32bit compiling configure.in
+- added db-Makefile.in
* Fri May 09 2003 - kukuk@suse.de
- Fix compiling with new db4.1 interface
* Thu Jan 16 2003 - kukuk@suse.de