Drop newsyslog's configuration into etc/newsyslog.conf.d.

Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold
2016-12-26 17:30:00 +00:00
parent e7ec65055d
commit 07e393b388
9 changed files with 15 additions and 83 deletions

View File

@@ -3,6 +3,7 @@
PORTNAME= munin
PORTVERSION= ${MUNIN_VERSION}
PORTREVISION= 1
CATEGORIES= sysutils perl5
MASTER_SITES= ${MUNIN_SITES}
PKGNAMESUFFIX= -node
@@ -84,5 +85,6 @@ post-install:
${INSTALL_MAN} munin-node.conf.5 ${STAGEDIR}${MAN5PREFIX}/man/man5; \
${INSTALL_MAN} munin.8 ${STAGEDIR}${MAN8PREFIX}/man/man8; \
)
${INSTALL_DATA} ${FILESDIR}/newsyslog ${STAGEDIR}${ETCDIR}/munin-node.newsyslog
.include <bsd.port.mk>

View File

@@ -0,0 +1 @@
/var/log/munin/munin-node.log 644 7 * @T00 Z /var/run/munin/munin-node.pid

View File

@@ -1,32 +0,0 @@
#! /bin/sh
delnewsyslog() {
tmp="/etc/#munin-node$$"
sed -e '/^\/var\/log\/munin\/munin-node.log[ ]/d' /etc/newsyslog.conf >${tmp}
cat ${tmp} > /etc/newsyslog.conf
rm ${tmp}
}
newsyslog() {
ENTRY=`grep /var/log/munin/munin-node.log /etc/newsyslog.conf`
DEFAULT='/var/log/munin/munin-node.log 644 7 * @T00 Z /var/run/munin/munin-node.pid'
if [ -z "$ENTRY" ]; then
exit 0
elif [ "$ENTRY" = "$DEFAULT" ]; then
delnewsyslog
else
echo "You have changed the default munin-node entry in \"/etc/newsyslog.conf\"".
echo "If you deinstall munin-node permanently, you have to manually remove it"
fi
}
case $2 in
DEINSTALL)
if [ -z "${PACKAGE_BUILDING}" ]; then
newsyslog
fi
;;
POST-DEINSTALL)
;;
esac

View File

@@ -12,26 +12,13 @@ init_plugins() {
echo "done."
}
newsyslog() {
if grep -q /var/log/munin/munin-node.log /etc/newsyslog.conf; then
:
else
cat >> /etc/newsyslog.conf <<EOT
/var/log/munin/munin-node.log 644 7 * @T00 Z /var/run/munin/munin-node.pid
EOT
fi
}
########################################################################
case $2 in
PRE-INSTALL)
;;
POST-INSTALL)
if [ -z "${PACKAGE_BUILDING}" ]; then
init_plugins
newsyslog
fi
;;
esac

View File

@@ -1,6 +1,11 @@
bin/munindoc
@sample %%ETCDIR%%/munin-node.conf.sample
@sample %%ETCDIR%%/plugin-conf.d/plugins.conf.sample
@comment the directory exists in STAGEDIR because it is present in
@comment BSD.local.dist but if not registered here, it will not exist in PREFIX
@comment when the package is installed.
@dir etc/newsyslog.conf.d
@sample %%ETCDIR%%/munin-node.newsyslog etc/newsyslog.conf.d/munin-node
%%SITE_PERL%%/Munin/Node/Config.pm
%%SITE_PERL%%/Munin/Node/Configure/Debug.pm
%%SITE_PERL%%/Munin/Node/Configure/History.pm