diff --git a/bind8/bind8.spec b/bind8/bind8.spec index 49372389f8..320d5d916a 100644 --- a/bind8/bind8.spec +++ b/bind8/bind8.spec @@ -33,7 +33,7 @@ Distribution: OpenPKG [PLUS] Group: DNS License: GPL Version: 8.4.1 -Release: 20030723 +Release: 20030814 # list of sources Source0: ftp://ftp.isc.org/isc/bind/src/%{version}/bind-src.tar.gz @@ -153,20 +153,24 @@ Conflicts: bind, powerdns rm -rf $RPM_BUILD_ROOT %pre - if [ $1 -gt 1 ]; then - # stop daemon before any upgrade - ls >/dev/null 2>&1 $RPM_INSTALL_PREFIX/var/bind/ndc \ - && $RPM_INSTALL_PREFIX/sbin/ndc stop >/dev/null 2>&1 \ - || true + # before upgrade, save status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} bind8 status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} bind8 stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 2 ]; then + # after upgrade, restore status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} + [ ".$bind8_active" = .yes ] && %{l_rc} bind8 start fi + exit 0 %preun - if [ $1 -eq 0 ]; then - # stop daemon before removing package - ls >/dev/null 2>&1 $RPM_INSTALL_PREFIX/var/bind/ndc \ - && $RPM_INSTALL_PREFIX/sbin/ndc stop >/dev/null 2>&1 \ - || true - # remove dynamically generated files - rm -f $RPM_INSTALL_PREFIX/var/bind/* - fi + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} bind8 stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/bind/*.log.* >/dev/null 2>&1 || true + exit 0 diff --git a/bind8/rc.bind8 b/bind8/rc.bind8 index caec479b75..13c99f885c 100644 --- a/bind8/rc.bind8 +++ b/bind8/rc.bind8 @@ -5,6 +5,8 @@ %config bind8_enable="$openpkg_rc_def" + bind8_log_prolog="true" + bind8_log_epilog="true" bind8_log_numfiles="5" bind8_log_minsize="512K" bind8_log_complevel="9" @@ -19,25 +21,32 @@ %start -p 100 -u @l_susr@ rcService bind8 enable yes || exit 0 + rcService bind8 active yes && exit 0 @l_prefix@/sbin/ndc start %stop -p 100 -u @l_susr@ rcService bind8 enable yes || exit 0 + rcService bind8 active no && exit 0 @l_prefix@/sbin/ndc stop %restart -p 100 -u @l_susr@ rcService bind8 enable yes || exit 0 + rcService bind8 active no && exit 0 @l_prefix@/sbin/ndc restart %reload -p 100 -u @l_susr@ rcService bind8 enable yes || exit 0 + rcService bind8 active no && exit 0 @l_prefix@/sbin/ndc reload %daily -u @l_susr@ rcService bind8 enable yes || exit 0 + + # rotate logfile shtool rotate -f \ - -n ${bind8_log_numfiles} -s ${bind8_log_minsize} \ - -d -z ${bind8_log_complevel} -o @l_musr@ -o @l_mgrp@ -m 644 \ - -E '@l_prefix@/sbin/ndc restart | grep -v "new pid is"' \ + -n ${bind8_log_numfiles} -s ${bind8_log_minsize} -d \ + -z ${bind8_log_complevel} -o @l_susr@ -o @l_mgrp@ -m 644 \ + -P "${bind8_log_prolog}" \ + -E "${bind8_log_epilog} && rc bind8 restart" \ @l_prefix@/var/bind/named.log