Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates > by-pkgid > 2c667ae25bc7a9579fdbcdd5678da616 > scriptlet

bind-9.8.3P4-1.mga1.i586.rpm

PREIN

/bin/sh
/usr/share/rpm-helper/add-user bind $1 named /var/lib/named /bin/false 

# check if bind is chrooted and try to restore it
if [ -x /usr/sbin/bind-chroot.sh ]; then
    ROOTDIR="/var/lib/named-chroot"
    [ -f /etc/sysconfig/named ] && . /etc/sysconfig/named
    if [ -d $ROOTDIR -a ! -d /var/lib/named ]; then
	echo "old chroot found at $ROOTDIR, copying to /var/lib/named"
        cp -rp $ROOTDIR /var/lib/named
	chown -R named:named /var/lib/named
    fi
    if grep -q "$ROOTDIR" /etc/sysconfig/syslog; then
	if [ -f /var/lock/subsys/named ]; then
	    service named stop > /dev/null 2>/dev/null || :
	fi
	/usr/sbin/bind-chroot.sh --unchroot > /dev/null 2>/dev/null || :
    fi
    if [ -f /var/lock/subsys/syslog ]; then
	service syslog restart  > /dev/null 2>/dev/null || :
    fi
fi

DATE=`date +%Y%m%d%j%S`
for f in named.conf rndc.conf rndc.key; do
    # move away files to prepare for softlinks
    if [ -f /etc/$f -a ! -h /etc/$f ]; then mv -vf /etc/$f /etc/$f.$DATE; fi
    if [ -f /etc/$f -a ! -h /etc/$f ]; then mv -vf /etc/$f /etc/$f.$DATE; fi
    if [ -f /etc/$f -a ! -h /etc/$f ]; then mv -vf /etc/$f /etc/$f.$DATE; fi
done

PREUN

/bin/sh
/usr/share/rpm-helper/del-service bind $1 named

POSTIN

/bin/sh
if grep -q "_MY_KEY_" /var/lib/named/etc/rndc.conf /var/lib/named/etc/rndc.key; then
    MYKEY="`/usr/sbin/dns-keygen`"
    perl -pi -e "s|_MY_KEY_|$MYKEY|g" /var/lib/named/etc/rndc.conf /var/lib/named/etc/rndc.key
fi

/usr/share/rpm-helper/add-service bind $1 named

POSTUN

/bin/sh
/usr/share/rpm-helper/del-user bind $1 named