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
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=429557
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= -master
@ -61,6 +62,7 @@ post-install:
)
(cd ${STAGEDIR}${ETCDIR}; for i in `find . -type f`; do mv $$i $$i.sample; done)
${MV} ${STAGEDIR}${WWWDIR}/.htaccess ${STAGEDIR}${WWWDIR}/.htaccess.sample
${INSTALL_DATA} ${FILESDIR}/newsyslog ${STAGEDIR}${ETCDIR}/munin-master.newsyslog
.include <bsd.port.pre.mk>

View file

@ -53,39 +53,11 @@ delete_crontab_entries() {
rm $TMPFILE
}
delnewsyslog() {
tmp=`mktemp -t munin` || exit 1
sed -e '/^\/var\/log\/munin\/\*\.log[ ]/d' /etc/newsyslog.conf >${tmp}
cat ${tmp} > /etc/newsyslog.conf
rm ${tmp}
}
newsyslog() {
ENTRY=`fgrep '/var/log/munin/*' /etc/newsyslog.conf`
DEFAULT='/var/log/munin/*.log munin:munin 644 7 * @T00 GNWZ'
if [ -z "$ENTRY" ]
then
exit 0
elif [ "$ENTRY" = "$DEFAULT" ]
then
delnewsyslog
elif yesno "You have changed the default munin-master entry in \"/etc/newsyslog.conf\".
Do you want me to delete it?" y
then
delnewsyslog
echo "Done."
fi
}
case $2 in
DEINSTALL)
if [ -z "${PACKAGE_BUILDING}" ]
then
delete_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN'
newsyslog
fi
;;
POST-DEINSTALL)
;;
esac

View file

@ -52,15 +52,6 @@ create_crontab_entries() {
fi
}
newsyslog() {
if ! fgrep -q '/var/log/munin/*' /etc/newsyslog.conf
then
cat >> /etc/newsyslog.conf <<EOT
/var/log/munin/*.log munin:munin 644 7 * @T00 GNWZ
EOT
fi
}
move_www_dir() {
if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ]
then
@ -79,7 +70,6 @@ case $2 in
POST-INSTALL)
if [ -z "${PACKAGE_BUILDING}" ]
then
newsyslog
create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT
#BEGIN_MUNIN_MAIN
MAILTO=root

View file

@ -33,6 +33,11 @@ bin/munin-cron
@sample %%ETCDIR%%/templates/partial/logo_path.tmpl.sample
@sample %%ETCDIR%%/templates/partial/navigation.tmpl.sample
@sample %%ETCDIR%%/templates/partial/path.tmpl.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-master.newsyslog etc/newsyslog.conf.d/munin-master
%%SITE_PERL%%/Munin/Master/Config.pm
%%SITE_PERL%%/Munin/Master/GraphOld.pm
%%SITE_PERL%%/Munin/Master/Group.pm

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