From 1c28ac64f7655921b35d3bca51f9d84499f5f77a Mon Sep 17 00:00:00 2001 From: jvdias Date: Fri, 10 Sep 2004 22:01:16 +0000 Subject: [PATCH] fix bugs 132303, 131803: %postun problems after upgrade from bind-chroot-9.2.2-21 --- bind.spec | 69 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/bind.spec b/bind.spec index b4f290b..39a81ae 100644 --- a/bind.spec +++ b/bind.spec @@ -1,4 +1,3 @@ - %define posix_threads 0 Summary: A DNS (Domain Name System) server. Name: bind @@ -25,7 +24,7 @@ Patch9: bind-9.2.3rc3-deprecation_msg_shut_up.diff.bz2 Url: http://www.isc.org/products/BIND/ Buildroot: %{_tmppath}/%{name}-root Version: 9.2.4rc7 -Release: 10 +Release: 12 Epoch: 10 BuildRequires: openssl-devel gcc glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar Requires(pre,preun): shadow-utils @@ -141,13 +140,12 @@ safe_replace() chmod $m $f2; return 0; } -if /usr/bin/test -r /etc/sysconfig/named && /bin/egrep -q '^ROOTDIR=' /etc/sysconfig/named -then : +if /usr/bin/test -r /etc/sysconfig/named && /bin/egrep -q '^ROOTDIR=' /etc/sysconfig/named; then + :; else -echo ROOTDIR="%{prefix}" >>/etc/sysconfig/named; + echo ROOTDIR="%{prefix}" >>/etc/sysconfig/named; fi -if /usr/bin/test -r /etc/localtime -then +if /usr/bin/test -r /etc/localtime; then /bin/cp -fp /etc/localtime "%{prefix}/etc/localtime" fi safe_replace /etc/rndc.key "%{prefix}/etc/rndc.key" root named 644 ''; @@ -180,10 +178,11 @@ done [ ! -e "%{prefix}/dev/zero" ] && mknod "%{prefix}/dev/zero" c 1 5 [ ! -e "%{prefix}/dev/null" ] && mknod "%{prefix}/dev/null" c 1 3 chmod a+r "%{prefix}/dev/random" "%{prefix}/dev/null" "%{prefix}/dev/" -chown named:named "%{prefix}/var/named" +chown root:named "%{prefix}/var/named" chown named:named "%{prefix}/var/named/slaves" -if /etc/init.d/named condrestart -then : +chown named:named "%{prefix}/var/named/data" +if /etc/init.d/named condrestart; then + :; fi %preun chroot @@ -196,16 +195,29 @@ if [ "$1" = "0" ]; then /bin/mv $f $F; fi; done - if test -r /etc/sysconfig/named && grep -q ^ROOTDIR= /etc/sysconfig/named - then + if test -r /etc/sysconfig/named && grep -q '^ROOTDIR=' /etc/sysconfig/named; then grep -v ROOTDIR="%{prefix}" /etc/sysconfig/named > /tmp/named mv -f /tmp/named /etc/sysconfig/named fi - if /etc/init.d/named condrestart - then : + if /etc/init.d/named condrestart; then + :; fi fi +%triggerpostun -n bind-chroot -- bind-chroot +# Fix mess left by bind-chroot-9.2.2's %preun (bug 131803) +# (or by RPM not passing [ $1 -gt 0 ] to bind-chroot-9.2.4-10_EL3 during upgrade ?!?!) +if [ "$1" -gt 0 ]; then + if test -r /etc/sysconfig/named && grep -q '^ROOTDIR=' /etc/sysconfig/named; then + :; + else + echo 'ROOTDIR='%{prefix} >> /etc/sysconfig/named + if /etc/init.d/named condrestart; then + :; + fi; + fi; +fi; + %prep %setup -q -n %{name}-%{version} %patch -p1 -b .varrun @@ -291,20 +303,12 @@ if [ $1 = 1 ]; then chmod 644 /etc/named.conf fi fi - if [ ! -e /etc/rndc.key.rpmnew ]; then + if grep -q '@KEY@' /etc/rndc.key; then sed -e "s/@KEY@/`/usr/sbin/dns-keygen`/" /etc/rndc.key >/etc/rndc.key.tmp mv -f /etc/rndc.key.tmp /etc/rndc.key fi if [ ! -s /etc/named.conf ]; then - echo ' -// Default named.conf generated by install of bind-'%{version}'-'%{release}' -options { - directory "/var/named"; - dump-file "/var/named/data/cache_dump.db"; - statistics-file "/var/named/data/named_stats.txt"; - }; -include "/etc/rndc.key"; -' > /etc/named.conf; + echo -e '// Default named.conf generated by install of bind-'%{version}'-'%{release}'\noptions {\n\tdirectory "/var/named";\n\tdump-file "/var/named/data/cache_dump.db";\n\tstatistics-file "/var/named/data/named_stats.txt";\n};\ninclude "/etc/rndc.key";\n' > /etc/named.conf; fi; if [ -x /sbin/restorecon ]; then # @@ -313,7 +317,7 @@ include "/etc/rndc.key"; /sbin/restorecon /etc/rndc.key /etc/rndc.conf fi chmod 0640 /etc/rndc.conf /etc/rndc.key - chown root:named /etc/rndc.conf /etc/rndc.key + chown root:named /etc/rndc.conf /etc/rndc.key /etc/named.conf /sbin/ldconfig fi exit 0 @@ -376,7 +380,7 @@ rm -rf ${RPM_BUILD_ROOT} ${RPM_BUILD_DIR}/%{name}-%{version} %attr(770,named,named) %dir /var/named/slaves %attr(770,named,named) %dir /var/named/data %attr(770,named,named) %dir /var/run/named - + %files libs %defattr(-,root,root) %{_libdir}/*so* @@ -402,7 +406,18 @@ rm -rf ${RPM_BUILD_ROOT} ${RPM_BUILD_DIR}/%{name}-%{version} %doc doc/draft doc/rfc %changelog -* Mon Aug 30 2004 Jason Vas Dias - 10:9.2.7-rc7-10 +* Fri Sep 10 2004 Jason Vas Dias - 10:9.2.4rc7-12_EL3 +- Fix bug 132303: if ROOTDIR line was replaced after upgrade from +- bind-chroot-9.2.2-21, restart named + +* Wed Sep 8 2004 Jason Vas Dias - 10:9.2.4rc7-11_EL3 +- Fix bug 131803: replace ROOTDIR line removed by broken +- bind-chroot 9.2.2-21's '%postun'; added %triggerpostun for bind-chroot + +* Tue Sep 7 2004 Jason Vas Dias - 10:9.2.4rc7-10_EL3 +- Fix bugs 130121 & 130981 for RHEL-3 + +* Mon Aug 30 2004 Jason Vas Dias - 10:9.2.4rc7-10 - Fix bug 130121: add '%ghost' entries for files included in previous - bind-chroot & not in current - ie. named.conf, rndc.key, dev/* - - that RPM removed after upgrade .