Index: bind.spec
===================================================================
RCS file: /cvs/dist/devel/bind/bind.spec,v
retrieving revision 1.98
diff -u -r1.98 bind.spec
--- bind.spec	22 Mar 2006 18:02:50 -0000	1.98
+++ bind.spec	23 Mar 2006 18:22:13 -0000
@@ -1,11 +1,11 @@
 #
 #               Red Hat BIND package .spec file
-# 
+#
 %{?!SDB:        %define SDB         1}
 %{?!LIBBIND:    %define LIBBIND	    1}
 %{?!efence:     %define efence      0}
 %{?!test:       %define test        0}
-%{?!WITH_DBUS:  %define WITH_DBUS   1} # + dynamic forwarder table management with D-BUS 
+%{?!WITH_DBUS:  %define WITH_DBUS   1} # + dynamic forwarder table management with D-BUS
 %{?!DEBUGINFO:  %define DEBUGINFO   1}
 %{?!bind_uid:   %define bind_uid   25}
 %{?!bind_gid:   %define bind_gid   25}
@@ -84,27 +84,27 @@
 Patch28: 	bind-9.3.2rc1-dbus-0.6.patch
 Patch29: 	bind-9.3.2-bz177854.patch
 #
-Requires:		bind-libs = %{epoch}:%{version}-%{release}, glibc  >= 2.2
-Requires(post): 	bash, textutils, fileutils, sed, grep
-Requires(pre): 		shadow-utils
-Requires(post,preun): 	chkconfig >= 1.3.26
-%if %{selinux}
-Requires(post):	        policycoreutils
-%endif
-%if %{SDB}
 %if %{WITH_DBUS}
-BuildRequires: 		openssl-devel gcc dbus-devel glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar openldap-devel postgresql-devel
-%else
-BuildRequires: 		openssl-devel gcc glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar openldap-devel postgresql-devel
+BuildRequires:	dbus-devel
 %endif
-%else
-%if %{WITH_DBUS}
-BuildRequires: 		openssl-devel gcc dbus-devel glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar
-%else
-BuildRequires: 		openssl-devel gcc glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar
+BuildRequires: 	openssl-devel
+BuildRequires:	glibc-devel >= 2.2.5-26
+BuildRequires:	glibc-kernheaders >= 2.4-7.10
+BuildRequires:	libtool
+BuildRequires:	pkgconfig
+%if %{SDB}
+BuildRequires:	openldap-devel
+BuildRequires:	postgresql-devel
 %endif
+Requires:	bind-libs = %{epoch}:%{version}-%{release}, glibc  >= 2.2
+Requires(post): bash, coreutils, sed, grep
+Requires(pre): 	shadow-utils
+Requires(post): chkconfig >= 1.3.26
+Requires(preun):chkconfig >= 1.3.26
+%if %{selinux}
+Requires(post):	policycoreutils
 %endif
-# fix bug 176100: do not Require: perl just for namedGetForwarders ! 
+# fix bug 176100: do not Require: perl just for namedGetForwarders !
 %define __perl_requires %SOURCE15
 %define __find_requires %SOURCE15
 %define _use_internal_dependency_generator 0
@@ -118,7 +118,7 @@
 tools for verifying that the DNS server is operating properly.
 
 
-%package  libs
+%package libs
 Summary:  Libraries used by various DNS packages
 Group:    Applications/System
 
@@ -126,10 +126,10 @@
 Contains libraries used by both the bind server package as well as the utils packages.
 
 
-%package  utils
-Summary:  Utilities for querying DNS name servers.
-Group:    Applications/System
-Requires: bind-libs = %{epoch}:%{version}-%{release}
+%package utils
+Summary:	Utilities for querying DNS name servers.
+Group:		Applications/System
+Requires:	bind-libs = %{epoch}:%{version}-%{release}
 
 %description utils
 Bind-utils contains a collection of utilities for querying DNS (Domain
@@ -142,10 +142,10 @@
 servers.
 
 
-%package   devel
-Summary:   Include files and libraries needed for bind DNS development.
-Group:     Development/Libraries
-Requires:  bind-libs = %{epoch}:%{version}-%{release}
+%package devel
+Summary:	Header files and libraries needed for bind DNS development.
+Group:		Development/Libraries
+Requires:	bind-libs = %{epoch}:%{version}-%{release}
 
 %description devel
 The bind-devel package contains all the include files and the library
@@ -153,35 +153,34 @@
 9.x.x.
 
 
-%package   config
-Summary:   Default BIND configuration files for a caching nameserver
-Group: 	   System Environment/Daemons
-Obsoletes: caching-nameserver
-Provides:  caching-nameserver
-Requires:  bind = %{epoch}:%{version}-%{release}
-Requires(post): bash, textutils, fileutils, sed, grep
+%package config
+Summary:	Default BIND configuration files for a caching nameserver
+Group:		System Environment/Daemons
+Obsoletes:	caching-nameserver
+Provides:	caching-nameserver
+Requires:	bind = %{epoch}:%{version}-%{release}
+Requires(post):	bash, coreutils, sed, grep
 %if %{selinux}
-Requires(post): policycoreutils
+Requires(post):	policycoreutils
 %endif
 
 %description config
-The bind-config package includes the configuration files which will make 
+The bind-config package includes the configuration files which will make
 the ISC BIND named DNS name server act as a simple caching nameserver.
 A caching nameserver is a DNS Resolver, as defined in RFC 1035, section 7.
-ISC BIND named(8) provides a very efficient, flexible and robust resolver as 
-well as a server of authoritative DNS data - many users use this package 
+ISC BIND named(8) provides a very efficient, flexible and robust resolver as
+well as a server of authoritative DNS data - many users use this package
 along with BIND to implement their primary system DNS resolver service.
 If you would like to set up a caching name server, you'll need to install
-bind, bind-libs, and bind-utils along with this package.  
+bind, bind-libs, and bind-utils along with this package.
 This package replaces the caching-nameserver package.
 
-
-%package   chroot
+%package chroot
 Summary:   A chroot runtime environment for the ISC BIND DNS server, named(8)
 Group: 	   System Environment/Daemons
 Prefix:    %{chroot_prefix}
 Requires:  bind = %{epoch}:%{version}-%{release}
-Requires(post): bash, textutils, fileutils, sed, grep
+Requires(post): bash, coreutils, sed, grep
 %if %{selinux}
 Requires(post): policycoreutils
 %endif
@@ -191,9 +190,6 @@
 chroot(2) jail for the named(8) program from the BIND package.
 Based off code from Jan "Yenya" Kasprzak <kas@fi.muni.cz>
 
-
-%if %{LIBBIND}
-
 %package libbind-devel
 Summary: Include files and library needed to use the BIND resolver library.
 Group: Development/Libraries
@@ -204,16 +200,14 @@
 compatible with that from ISC BIND 8, and the /usr/include/bind include files
 necessary to develop software that uses it.
 
-%endif
-
-
-%if %{SDB}
-
 %package sdb
-Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends.
-Group: System Environment/Daemons
-Requires: bind-libs = %{epoch}:%{version}-%{release}, bind-utils = %{epoch}:%{version}-%{release},  glibc  >= 2.2
-Requires(post): bash, textutils, fileutils, sed, grep, mktemp
+Summary:	The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends.
+Group:		System Environment/Daemons
+Requires:	bind-libs = %{epoch}:%{version}-%{release}
+Requires:	bind-utils = %{epoch}:%{version}-%{release}
+Requires:	glibc >= 2.2
+Requires(post):	bash, coreutils, sed, grep, mktemp
+Requires(postun):sed
 %if %{selinux}
 Requires(post): policycoreutils
 %endif
@@ -225,38 +219,14 @@
 (routines for applications to use when interfacing with DNS); and
 tools for verifying that the DNS server is operating properly.
 
-BIND SDB (Simplified Database Backend) provides named_sdb, the DNS 
-name server compiled to include support for using alternative Zone Databases 
-stored in an LDAP server (ldapdb), a postgreSQL database (pgsqldb), or in the 
-filesystem (dirdb), in addition  to the standard in-memory RBT (Red Black Tree) 
-zone database. 
-
-%endif
-
+BIND SDB (Simplified Database Backend) provides named_sdb, the DNS
+name server compiled to include support for using alternative Zone Databases
+stored in an LDAP server (ldapdb), a postgreSQL database (pgsqldb), or in the
+filesystem (dirdb), in addition  to the standard in-memory RBT (Red Black Tree)
+zone database.
 
 %prep
-%setup -q -n %{name}-%{version}
-%patch -p1 -b .varrun
-%patch1 -p1 -b .key
-%patch2 -p1 -b .openssl_suffix
-#%define         posix_threads       0
-#%if %{posix_threads}
-#%patch3 -p1 -b .posixthreads
-#^- This patch is no longer required and would not work anyway (see BZ 87525).
-#%endif
-%patch4 -p1 -b .bsdcompat
-%patch5 -p1 -b .nonexec
-%patch6 -p1 -b .nsl
-#%patch7 -p1 -b .pie
-# This patch now in patch10
-#%patch8 -p1 -b .handle_send_errors
-# This patch is now in ISC bind-9.3.1x
-# 
-#%patch9 -p1 -b .missing_dnssec_tools
-#RIP dnssec-signkey and dnssec-makekeyset:
-#1852.	[cleanup]	Remove last vestiges of dnssec-signkey and
-#			dnssec-makekeyset (removed from Makefile years ago).
-#
+%setup -q
 %patch10 -p1 -b .PIE
 %if %{SDB}
 %patch11 -p1 -b .sdbsrc
@@ -316,11 +286,12 @@
 %endif
 %endif
 
+cp %{SOURCE5} doc/rfc
+gzip -9 doc/rfc/*
 
 %build
 libtoolize --copy --force; aclocal; autoconf
 cp -f /usr/share/libtool/config.{guess,sub} .
-export CFLAGS="$RPM_OPT_FLAGS"
 %if %{WITH_DBUS}
 %ifarch s390x x86_64 ppc64
 # every 64-bit arch EXCEPT ia64 has dbus architecture dependant
@@ -333,55 +304,38 @@
 	export CPPFLAGS="$CPPFLAGS `pkg-config --cflags-only-I openssl`"
 	export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`"
 fi
-#export CFLAGS="-g $CFLAGS"
 %if %{efence}
 export LDFLAGS=-lefence
 %endif
-%if %{LIBBIND}
-%configure --with-libtool --localstatedir=/var \
+%configure \
+	--with-libtool \
+	--localstatedir=/var \
 	--enable-threads \
 	--enable-ipv6 \
 	--with-pic \
 	--with-openssl=/usr \
+%if %{LIBBIND}
 	--enable-libbind
-%else
-%configure --with-libtool --localstatedir=/var \
-	--enable-threads \
-	--enable-ipv6 \
-	--with-pic \
-	--with-openssl=/usr
 %endif
 make %{?_smp_mflags}
-if [ $? -ne 0 ]; then
-   exit $?;
-fi;
-
-
-%if !%{DEBUGINFO}
-%define debug_package %{nil}
-%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-cp %{SOURCE5} doc/rfc
-gzip -9       doc/rfc/*
-mkdir -p ${RPM_BUILD_ROOT}/etc/{rc.d/init.d,logrotate.d}
-mkdir -p ${RPM_BUILD_ROOT}/usr/{bin,lib,sbin,include}
-mkdir -p ${RPM_BUILD_ROOT}/var/named
-mkdir -p ${RPM_BUILD_ROOT}/var/named/slaves
-mkdir -p ${RPM_BUILD_ROOT}/var/named/data
-mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/{man1,man5,man8}
-mkdir -p ${RPM_BUILD_ROOT}/var/run/named
+mkdir -p $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d}
+mkdir -p $RPM_BUILD_ROOT/var/named
+mkdir -p $RPM_BUILD_ROOT/var/named/slaves
+mkdir -p $RPM_BUILD_ROOT/var/named/data
+mkdir -p $RPM_BUILD_ROOT/var/run/named
 #chroot
-mkdir -p ${RPM_BUILD_ROOT}/%{chroot_prefix}
-tar --no-same-owner -zxvf %{SOURCE6} --directory ${RPM_BUILD_ROOT}/%{chroot_prefix} 
+mkdir -p $RPM_BUILD_ROOT%{chroot_prefix}
+tar --no-same-owner -zxvf %{SOURCE6} --directory $RPM_BUILD_ROOT%{chroot_prefix}
 # these are required to prevent them being erased during upgrade of previous
 # versions that included them (bug #130121):
-touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/etc/named.conf
-touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/etc/named.rfc1912.zones
-touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/etc/rndc.key
-touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/dev/null
-touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/dev/random
+touch $RPM_BUILD_ROOT%{chroot_prefix}/etc/named.conf
+touch $RPM_BUILD_ROOT%{chroot_prefix}/etc/named.rfc1912.zones
+touch $RPM_BUILD_ROOT%{chroot_prefix}/etc/rndc.key
+touch $RPM_BUILD_ROOT%{chroot_prefix}/dev/null
+touch $RPM_BUILD_ROOT%{chroot_prefix}/dev/random
 #end chroot
 make DESTDIR=$RPM_BUILD_ROOT install
 install -c -m 640 bin/rndc/rndc.conf $RPM_BUILD_ROOT%{_sysconfdir}
@@ -393,28 +347,26 @@
 key "rndckey" {
         algorithm       hmac-md5;
         secret "@KEY@";
-};
+}
 __EOF
 %{__cc} $RPM_OPT_FLAGS -o $RPM_BUILD_ROOT%{_sbindir}/dns-keygen %{SOURCE4}
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/named
-#mv $RPM_BUILD_ROOT/usr/share/man/man8/named.conf.* $RPM_BUILD_ROOT/usr/share/man/man5
 %if %{SDB}
 mkdir -p $RPM_BUILD_ROOT/etc/openldap/schema
-install -c -m 644 %{SOURCE8} $RPM_BUILD_ROOT/etc/openldap/schema/dnszone.schema
+install -m 644 %{SOURCE8} $RPM_BUILD_ROOT/etc/openldap/schema/dnszone.schema
 cp -fp %{SOURCE12} contrib/sdb/pgsql/
 %endif
 %if %{LIBBIND}
 gunzip < %{SOURCE9} | (cd $RPM_BUILD_ROOT/usr/share; tar -xpf -)
-mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
-cp -fp %{SOURCE28} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libbind.pc
-chmod 644 $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libbind.pc
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
+install -m 644 %{SOURCE28} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libbind.pc
 %endif
 %if %{WITH_DBUS}
 mkdir -p $RPM_BUILD_ROOT/etc/dbus-1/system.d
-mkdir -p $RPM_BUILD_ROOT/usr/share/dbus-1/services
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/dbus-1/services
 cp -fp %{SOURCE10} $RPM_BUILD_ROOT/etc/dbus-1/system.d/named.conf
-cp -fp %{SOURCE11} $RPM_BUILD_ROOT/usr/share/dbus-1/services/named.service
+cp -fp %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/dbus-1/services/named.service
 cp -fp %{SOURCE13} $RPM_BUILD_ROOT%{_sbindir}/namedSetForwarders
 cp -fp %{SOURCE14} $RPM_BUILD_ROOT%{_sbindir}/namedGetForwarders
 %endif
@@ -427,29 +379,29 @@
    ./ifconfig.sh up
    popd
    make test
-   e=$?   
+   e=$?
    pushd system
-   ./ifconfig.sh down	
+   ./ifconfig.sh down
    popd
    popd
    if [ "$e" -ne 0 ]; then
       echo "ERROR: this build of BIND failed 'make test'. Aborting."
-      exit $e;
-   fi;
+      exit $e
+   fi
 else
-   echo 'test==1 : only root can run the tests (they require an ifconfig).';   
+   echo 'test==1 : only root can run the tests (they require an ifconfig).'
 fi
-:;
 %endif
+
 # Files required to run test-suite outside of build tree:
 cp -fp config.h $RPM_BUILD_ROOT/%{_includedir}/bind9
 cp -fp lib/dns/include/dns/forward.h $RPM_BUILD_ROOT/%{_includedir}/dns
 cp -fp lib/isc/unix/include/isc/keyboard.h $RPM_BUILD_ROOT/%{_includedir}/isc
 cp -fp lib/isc/include/isc/hash.h $RPM_BUILD_ROOT/%{_includedir}/isc
 # Remove libtool .la files:
-find $RPM_BUILD_ROOT/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';';
+find $RPM_BUILD_ROOT/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';'
 # /usr/lib/rpm/brp-compress
-# 
+#
 # Ghost config files:
 touch $RPM_BUILD_ROOT/etc/named.conf
 # bind-config files:
@@ -464,20 +416,142 @@
 install -m 644 %{SOURCE22} $RPM_BUILD_ROOT/var/named/named.broadcast
 install -m 644 %{SOURCE23} $RPM_BUILD_ROOT/var/named/named.zero
 for f in /etc/named.caching-nameserver.conf /var/named/{named.ca,named.local,localhost.zone,localdomain.zone,named.ip6.local,named.broadcast,named.zero}; do
-    touch $RPM_BUILD_ROOT/%{chroot_prefix}/$f;
+    touch $RPM_BUILD_ROOT/%{chroot_prefix}/$f
 done
 install -m 644 %{SOURCE24} ./rfc1912.txt
 install -m 644 %{SOURCE25} ./Copyright
 # bind-chroot-admin script:
-sed -e 's^@BIND_CHROOT_PREFIX@^'%{chroot_prefix}'^;s^@BIND_DIR@^'%{bind_dir}'^' < %SOURCE26 > bind-chroot-admin;
+sed -e 's^@BIND_CHROOT_PREFIX@^'%{chroot_prefix}'^;s^@BIND_DIR@^'%{bind_dir}'^' < %{SOURCE26} > bind-chroot-admin
 install -m 754 bind-chroot-admin $RPM_BUILD_ROOT/%{_sbindir}
 %if !%{DEBUGINFO}
 echo 'WARNING - NOT generating debuginfo!'
 /usr/lib/rpm/brp-compress
 exit 0
 %endif
-:;
 
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+if [ "$1" -eq 1 ]; then
+	/usr/sbin/groupadd -g %{bind_gid} -f -r named >/dev/null 2>&1 || :
+	/usr/sbin/useradd  -u %{bind_uid} -r -n -M -g named -s /sbin/nologin -d /var/named -c Named named >/dev/null 2>&1 || :
+fi
+
+%post
+/sbin/ldconfig
+/sbin/chkconfig --add named
+if [ "$1" -eq 1 ]; then
+	if [ -f /etc/named.boot -a -x /usr/sbin/named-bootconf -a ! -f /etc/named.conf ]; then
+		# Convert BIND 4 named.bootconf syntax to BIND 9 syntax (should never be used!)
+		cat /etc/named.boot | /usr/sbin/named-bootconf > /etc/named.bootconf-converted.conf
+		if [ "$?" -eq 0 ]; then
+			chmod 644 /etc/named.bootconf-converted.conf
+			cp -fp /etc/named.bootconf-converted.conf /etc/named.conf
+		fi
+	fi
+	if /bin/egrep -q '@KEY@' /etc/rndc.key; then
+		/bin/sed -i -e "s^@KEY@^`/usr/sbin/dns-keygen`^" /etc/rndc.key
+		chmod 0640  /etc/rndc.key
+		chown root:named /etc/rndc.key
+	fi
+	[ -e /selinux/enforce ] && [ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.* /etc/named.* >/dev/null 2>&1
+fi
+
+%preun
+if [ "$1" = 0 ]; then
+	/etc/rc.d/init.d/named stop >/dev/null 2>&1 || :
+	/sbin/chkconfig --del named || :
+fi
+
+%postun
+if [ "$1" -ge 1 ]; then
+	/etc/rc.d/init.d/named condrestart >/dev/null 2>&1 || :   
+fi
+
+%triggerpostun -- bind < 8.2.2_P5-15
+/sbin/chkconfig --add named
+/sbin/ldconfig
+
+%triggerpostun -n bind -- bind <= 24:9.3.1-11
+if [ "$1" -gt 0 ]; then
+# bind <= 22:9.3.0-2:
+# These versions of bind installed named service at order 55 in
+# runlevel startup order, after programs like  nis / ntp / nfs
+# which may need its services if using no nameservers in resolv.conf.
+# bind <= 24:9.3.1-11:
+# These versions ran bind with order 11 in runlevel 2, after syslog
+# at order 12 . BIND should run after syslog and now has order '- 13 87'.
+#
+    /sbin/chkconfig named resetpriorities
+fi
+
+%post   libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
+
+%postun utils
+if [ $1 = 0 ]; then
+	if [ -f /var/lock/subsys/named ]; then
+		etc/rc.d/init.d/named stop >/dev/null 2>&1 || :
+	fi
+fi
+
+%post config
+if [ "$1" -gt 0 ]; then
+	/usr/bin/chcon system_u:object_r:named_conf_t /etc/named.caching-nameserver.conf >/dev/null 2>&1 || :
+	/usr/bin/chcon system_u:object_r:named_conf_t /etc/named.rfc1912.zones >/dev/null 2>&1 || :
+fi
+if [ "$1" -eq 1 ]; then
+	/usr/sbin/bind-chroot-admin --sync
+fi
+
+%postun config
+if [ "$1" -eq 0 ]; then
+	/usr/sbin/bind-chroot-admin --sync
+fi
+
+%post chroot
+if [ "$1" -gt 0 ]; then
+	/usr/sbin/bind-chroot-admin --enable
+fi
+
+%preun chroot
+if [ "$1" = "0" ]; then
+	/usr/sbin/bind-chroot-admin --disable
+fi
+
+%post   libbind-devel -p /sbin/ldconfig
+%postun libbind-devel -p /sbin/ldconfig
+
+%post sdb
+if [ "$1" -ge 1 ]; then
+	# check that dnszone.schema is installed in OpenLDAP's slapd.conf
+	if [ -x /usr/sbin/named_sdb ] && [ -f /etc/openldap/slapd.conf ]; then
+		# include the LDAP dnszone.schema in slapd.conf:
+		if ! /bin/egrep -q '^include.*\dnszone.schema' /etc/openldap/slapd.conf; then
+			tf=`/bin/mktemp /tmp/XXXXXX`
+			lt n=`/bin/grep -n '^include.*\.schema' /etc/openldap/slapd.conf | /usr/bin/tail -1 | /bin/sed 's/:.*//'`
+			if [ "$n" -gt 0 ]; then
+				/bin/cp -fp /etc/openldap/slapd.conf /etc/openldap/slapd.conf.rpmsave
+				/usr/bin/head -$n /etc/openldap/slapd.conf > $tf
+    				echo 'include         /etc/openldap/schema/dnszone.schema' >> $tf
+				let n='n+1'
+				/usr/bin/tail -n +$n /etc/openldap/slapd.conf >> $tf
+				/bin/mv -f $tf /etc/openldap/slapd.conf
+				/bin/chmod --reference=/etc/openldap/slapd.conf.rpmsave /etc/openldap/slapd.conf
+				[ -e /selinux/enforce ] && [ -x /sbin/restorecon ] && /sbin/restorecon /etc/openldap/slapd.conf >/dev/null 2>&1 || :
+				[ -x /etc/init.d/ldap ] && /etc/init.d/ldap condrestart >/dev/null 2>&1
+			fi
+			rm -f $tf >/dev/null 2>&1 || :
+		fi
+	fi
+fi
+
+%preun sdb
+if [ "$1" -eq 0 ] && [ -x /usr/sbin/named_sdb ] && [ -f /etc/openldap/slapd.conf ]; then
+	sed -i '/^include.*\dnszone.schema/d /etc/openldap/slapd.conf
+	[ -x /etc/init.d/ldap ] && /etc/init.d/ldap condrestart >/dev/null 2>&1 || :
+fi
 
 %files
 %defattr(-,root,root)
@@ -489,7 +563,7 @@
 %config(noreplace) /etc/sysconfig/named
 %verify(not size,not md5) %config(noreplace) %attr(0640,root,named) /etc/rndc.key
 # %verify(not size,not md5) %config(noreplace) %attr(0640,root,named) /etc/rndc.conf
-# ^- Let the named internal default rndc.conf be used - 
+# ^- Let the named internal default rndc.conf be used -
 #    rndc.conf not required unless it differs from default.
 %ghost %config(noreplace) /etc/named.conf
 # ^- Ensure something owns named.conf, even though it may not be installed at all
@@ -524,7 +598,7 @@
 
 %files libs
 %defattr(-,root,root)
-%{_libdir}/*so*
+%{_libdir}/*so.*
 
 %files utils
 %defattr(-,root,root)
@@ -539,6 +613,7 @@
 
 %files devel
 %defattr(-,root,root)
+%{_libdir}/*so
 %{_libdir}/libbind9.a
 %{_libdir}/libdns.a
 %{_libdir}/libisc.a
@@ -554,7 +629,7 @@
 %{_includedir}/lwres
 %{_mandir}/man3/lwres*
 %{_bindir}/isc-config.sh
-%doc doc/draft doc/rfc 
+%doc doc/draft doc/rfc
 
 %files config
 %defattr(-,root,root)
@@ -628,167 +703,6 @@
 
 %endif
 
-
-%pre
-if [ "$1" -eq 1 ]; then
-   /usr/sbin/groupadd -g %{bind_gid} -f -r named >/dev/null 2>&1 || :;
-   /usr/sbin/useradd  -u %{bind_uid} -r -n -M -g named -s /sbin/nologin -d /var/named -c Named named >/dev/null 2>&1 || :;
-fi;
-:;
-
-%post
-/sbin/ldconfig
-/sbin/chkconfig --add named
-if [ "$1" -eq 1 ]; then
-	if [ -f /etc/named.boot -a -x /usr/sbin/named-bootconf -a ! -f /etc/named.conf ]; then
-	   # Convert BIND 4 named.bootconf syntax to BIND 9 syntax (should never be used!) 
-	   cat /etc/named.boot | /usr/sbin/named-bootconf > /etc/named.bootconf-converted.conf
-	   if [ "$?" -eq 0 ]; then
-	      chmod 644 /etc/named.bootconf-converted.conf
-	      cp -fp /etc/named.bootconf-converted.conf /etc/named.conf;
-	   fi;
-	fi
-	if /bin/egrep -q '@KEY@' /etc/rndc.key; then
-	   /bin/sed -i -e "s^@KEY@^`/usr/sbin/dns-keygen`^" /etc/rndc.key ;
-  	   chmod 0640  /etc/rndc.key
-	   chown root:named /etc/rndc.key
-	fi
-        [ -e /selinux/enforce ] && [ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.* /etc/named.* >/dev/null 2>&1 ;
-fi
-:;
-
-%preun
-if [ "$1" = 0 ]; then
-   /etc/rc.d/init.d/named stop >/dev/null 2>&1 || :;
-   /sbin/chkconfig --del named || :;
-fi
-:;
-
-%postun
-/sbin/ldconfig
-if [ "$1" -ge 1 ]; then
-   /etc/rc.d/init.d/named condrestart >/dev/null 2>&1 || :   	   
-fi;
-:;
-
-%triggerpostun -- bind < 8.2.2_P5-15
-/sbin/chkconfig --add named
-/sbin/ldconfig
-:;
-
-%triggerpostun -n bind -- bind <= 24:9.3.1-11
-if [ "$1" -gt 0 ]; then
-# bind <= 22:9.3.0-2:
-# These versions of bind installed named service at order 55 in 
-# runlevel startup order, after programs like  nis / ntp / nfs 
-# which may need its services if using no nameservers in resolv.conf.
-# bind <= 24:9.3.1-11:
-# These versions ran bind with order 11 in runlevel 2, after syslog
-# at order 12 . BIND should run after syslog and now has order '- 13 87'.
-# 
-    /sbin/chkconfig named resetpriorities
-fi
-:;
-
-%postun utils
-if [ $1 = 0 ]; then
-   if [ -f /var/lock/subsys/named ]; then
-      /etc/rc.d/init.d/named stop >/dev/null  2>&1 || :;
-   fi;
-fi;
-:;
-
-
-%post libs -p /sbin/ldconfig
-
-%postun libs -p /sbin/ldconfig
-
-
-%post config
-if [ "$1" -gt 0 ]; then
-   /usr/bin/chcon system_u:object_r:named_conf_t  /etc/named.caching-nameserver.conf >/dev/null 2>&1 || :;
-   /usr/bin/chcon system_u:object_r:named_conf_t  /etc/named.rfc1912.zones >/dev/null 2>&1 || :;
-fi
-if [ "$1" -eq 1 ]; then
-   /usr/sbin/bind-chroot-admin --sync;
-fi;
-:;
-
-%postun config
-if [ "$1" -eq 0 ]; then
-   /usr/sbin/bind-chroot-admin --sync
-fi;
-:;
-
-
-%post chroot
-if [ "$1" -gt 0 ]; then
-   /usr/sbin/bind-chroot-admin --enable;
-fi;
-:;
-
-%preun chroot
-if [ "$1" = "0" ]; then
-   /usr/sbin/bind-chroot-admin --disable;
-fi
-:;
-
-
-%if %{LIBBIND}
-
-%post libbind-devel -p /sbin/ldconfig
-
-%postun libbind-devel -p /sbin/ldconfig
-
-%endif
-
-
-%if %{SDB}
-
-%post sdb
-if [ "$1" -ge 1 ]; then
-   # check that dnszone.schema is installed in OpenLDAP's slapd.conf
-   if [ -x /usr/sbin/named_sdb ] && [ -f /etc/openldap/slapd.conf ]; then
-   # include the LDAP dnszone.schema in slapd.conf:
-      if ! /bin/egrep -q '^include.*\dnszone.schema' /etc/openldap/slapd.conf; then
-         tf=`/bin/mktemp /tmp/XXXXXX`
-         let n=`/bin/grep -n '^include.*\.schema' /etc/openldap/slapd.conf | /usr/bin/tail -1 | /bin/sed 's/:.*//'`
-         if [ "$n" -gt 0 ]; then
-   	    /bin/cp -fp /etc/openldap/slapd.conf /etc/openldap/slapd.conf.rpmsave;
-	    /usr/bin/head -$n /etc/openldap/slapd.conf > $tf
-            echo 'include         /etc/openldap/schema/dnszone.schema' >> $tf
-            let n='n+1'
-            /usr/bin/tail -n +$n /etc/openldap/slapd.conf >> $tf
-            /bin/mv -f $tf /etc/openldap/slapd.conf;
-            /bin/chmod --reference=/etc/openldap/slapd.conf.rpmsave /etc/openldap/slapd.conf
-            [ -e /selinux/enforce ] && [ -x /sbin/restorecon ] && /sbin/restorecon /etc/openldap/slapd.conf >/dev/null 2>&1 || :;
-            [ -x /etc/init.d/ldap ] && /etc/init.d/ldap condrestart >/dev/null 2>&1
-         fi
-         rm -f $tf >/dev/null 2>&1 || :;
-      fi;
-   fi;
-fi;
-:;
-
-%preun sdb
-if [ "$1" -eq 0 ] && [ -x /usr/sbin/named_sdb ] && [ -f /etc/openldap/slapd.conf ]; then
-   if /bin/egrep -q '^include.*\dnszone.schema' /etc/openldap/slapd.conf; then
-      tf=`/bin/mktemp /tmp/XXXXXX`
-      /bin/egrep -v '^include.*dnszone\.schema' /etc/openldap/slapd.conf > $tf
-      /bin/mv -f $tf /etc/openldap/slapd.conf;
-      rm -f $tf >/dev/null 2>&1
-      [ -e /selinux/enforce ] && [ -x /sbin/restorecon ] && /sbin/restorecon /etc/openldap/slapd.conf >/dev/null 2>&1 || :;
-      [ -x /etc/init.d/ldap ] && /etc/init.d/ldap condrestart >/dev/null 2>&1 || :;
-   fi;
-fi;
-:;
-
-%endif # SDB
-
-%clean
-rm -rf ${RPM_BUILD_ROOT}
-:;
-
 %changelog
 * Wed Mar 22 2006 Jason Vas Dias <jvdias@redhat.com> - 30:9.3.2-12
 - fix typo in initscript
