PREUN
/bin/sh
/usr/share/rpm-helper/del-service inn $1 innd
if [ $1 = 0 ]; then
if [ -f /var/lib/news/history.dir ]; then
rm -f /var/lib/news/history.*
fi
fi
POSTIN
/bin/sh
/usr/share/rpm-helper/add-service inn $1 innd
umask 002
touch /var/log/news/news.notice
touch /var/log/news/news.crit
touch /var/log/news/news.err
[ -f /var/lib/news/active.times ] || {
touch /var/lib/news/active.times
chown news.news /var/lib/news/active.times
}
chown -R news.news /var/log/news*
if [ `cat /etc/news/inn.conf | grep '^server:' | wc -l` -lt 1 ]; then
echo "server: `hostname -f`" >> /etc/news/inn.conf
fi
if [ -f /var/lib/news/history ]; then
cd /var/lib/news
/usr/bin/makedbz -s `wc -l <history` -f history
for i in dir hash index pag; do
[ -f history.n.$i ] && mv history.n.$i history.$i
done
chown news.news history.*
chmod 644 history.*
else
cd /var/lib/news
cp /dev/null history
/usr/bin/makehistory
/usr/bin/makedbz -s `wc -l <history` -f history
for i in dir hash index pag; do
[ -f history.n.$i ] && mv history.n.$i history.$i
done
chown news.news history history.*
chmod 644 history history.*
fi
POSTUN
/bin/sh
if [ "$1" -ge "1" ]; then
service innd condrestart > /dev/null 2>&1
fi
Triggers
sysklogd
/bin/sh
if [ -f /etc/syslog.conf ]; then
if grep -q "# News logging" /etc/syslog.conf; then
perl -pi -e "s!mail.none;authpriv.none!mail.none;news.none;authpriv.none!; \
s!/var/log/news/info!/var/log/news/news.notice!; \
s!/var/log/news/errors!/var/log/news/news.err!; \
s!/var/log/news/warnings!/var/log/news/news.crit!; \
s!^news.err!news.=err!; \
s!^news.=warn!news.=crit!; " /etc/syslog.conf
else
cat <> /etc/syslog.conf
# News logging
news.=debug;news.=info;news.=notice -/var/log/news/news.notice
news.=crit -/var/log/news/news.crit
news.err -/var/log/news/news.err
EOF
fi
if [ -f /var/run/syslog.pid ]; then
kill -HUP `cat /var/run/syslog.pid` 2> /dev/null ||:
fi
fi