FreeBSD Bugzilla – Attachment 239794 Details for
Bug 258072
sysutils/munin-master: install does not respect root directory for /var/cron/tabs/munin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
munin.cron
0001-sysutils-munin-master-node-change-cron-job-install.patch (text/plain), 9.39 KB, created by
Florian Smeets
on 2023-01-29 22:37:41 UTC
(
hide
)
Description:
munin.cron
Filename:
MIME Type:
Creator:
Florian Smeets
Created:
2023-01-29 22:37:41 UTC
Size:
9.39 KB
patch
obsolete
>From bcc31605dafa3803abce2fffd8e7a70311e121f0 Mon Sep 17 00:00:00 2001 >From: Florian Smeets <flo@FreeBSD.org> >Date: Sun, 29 Jan 2023 23:17:24 +0100 >Subject: [PATCH] sysutils/munin-{master,node}: change cron job install > >Don't rely on directly calling crontab to install the cron job, use the >etc/cron.d directory for which we've had support for a while. This >fixes installing munin-master using pkg -r as crontab installed the >cron job on the host system not in the specified alternative root >otherwise. > >Completely remove pkg-install, that also removes the automatic migration >for newsyslog files after src revision r340318 it's been 4 years and a >bit. > >Leave the pkg-deinstall script for a while to make sure that the >automatically installed cron jobs via crontab are removed. > >PR: 258072 >Reported by: Tassilo Philipp <tphilipp@potion-studios.com> >--- > sysutils/munin-master/Makefile | 3 + > sysutils/munin-master/files/cron | 1 + > sysutils/munin-master/files/pkg-message.in | 22 ----- > sysutils/munin-master/pkg-install | 100 --------------------- > sysutils/munin-master/pkg-plist | 2 + > sysutils/munin-node/files/pkg-message.in | 19 ---- > sysutils/munin-node/pkg-install | 42 --------- > 7 files changed, 6 insertions(+), 183 deletions(-) > create mode 100644 sysutils/munin-master/files/cron > delete mode 100644 sysutils/munin-master/pkg-install > delete mode 100644 sysutils/munin-node/pkg-install > >diff --git a/sysutils/munin-master/Makefile b/sysutils/munin-master/Makefile >index 9af9026bd64b..0dc2ad4203a0 100644 >--- a/sysutils/munin-master/Makefile >+++ b/sysutils/munin-master/Makefile >@@ -1,5 +1,6 @@ > PORTNAME= munin > PORTVERSION= ${MUNIN_VERSION} >+PORTREVISION= 1 > CATEGORIES= sysutils perl5 > MASTER_SITES= ${MUNIN_SITES} > PKGNAMESUFFIX= -master >@@ -57,5 +58,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 >+ ${MKDIR} ${STAGEDIR}${LOCALBASE}/etc/cron.d >+ ${INSTALL_DATA} ${FILESDIR}/cron ${STAGEDIR}${ETCDIR}/munin-master.cron > > .include <bsd.port.mk> >diff --git a/sysutils/munin-master/files/cron b/sysutils/munin-master/files/cron >new file mode 100644 >index 000000000000..aaa873114e8b >--- /dev/null >+++ b/sysutils/munin-master/files/cron >@@ -0,0 +1 @@ >+*/5 * * * * munin /usr/local/bin/munin-cron >diff --git a/sysutils/munin-master/files/pkg-message.in b/sysutils/munin-master/files/pkg-message.in >index 5bd0f0a0cc11..1a7d9382f644 100644 >--- a/sysutils/munin-master/files/pkg-message.in >+++ b/sysutils/munin-master/files/pkg-message.in >@@ -8,29 +8,7 @@ Please edit it according to your needs. > > The Munin server will be run from cron under the user 'munin'. > >-If you need to customize the munin crontab, remove the lines >-containing #BEGIN_MUNIN_MAIN and #END_MUNIN_MAIN, and add a line >-with #MANUAL_MUNIN_CRONTAB. > EOT > type: install > } >-{ >-message: <<EOT >-The munin-master newsyslog.conf(5) filename has been changed: >- OLD: ${PREFIX}/etc/newsyslog.conf.d/munin-master >- NEW: ${PREFIX}/etc/newsyslog.conf.d/munin-master.conf >- >-Any file found at the old location has been automatically moved to >-the new location. This was done to ensure log rotation continued to >-work after change r340318 made to FreeBSD base, where the default >-newsyslog configuration now only includes filenames that end with >-'.conf' and do not begin with '.'. >- >-If you use provisioning/configuration management tools to create or >-edit this file, you will need to change their configuration to use >-the new filename. >-EOT >-type: upgrade >-maximum_version: "2.0.43_1" >-} > ] >diff --git a/sysutils/munin-master/pkg-install b/sysutils/munin-master/pkg-install >deleted file mode 100644 >index 9a120494261c..000000000000 >--- a/sysutils/munin-master/pkg-install >+++ /dev/null >@@ -1,100 +0,0 @@ >-#! /bin/sh >-# ex:sw=4 sts=4 >- >-ask() { >- local question default answer >- >- question=$1 >- default=$2 >- if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ] >- then >- read -p "${question} [${default}]? " answer >- fi >- if [ x${answer} = x ] >- then >- answer=${default} >- fi >- echo ${answer} >-} >- >-yesno() { >- local dflt question answer >- >- question=$1 >- dflt=$2 >- while :; do >- answer=$(ask "${question}" "${dflt}") >- case "${answer}" in >- [Yy]*) return 0;; >- [Nn]*) return 1;; >- esac >- echo "Please answer yes or no." >- done >-} >- >-create_crontab_entries() { >- local b e >- b=$1 >- e=$2 >- >- if crontab -u munin -l > /dev/null 2>&1 >- then >- if ! crontab -u munin -l | grep -q MANUAL_MUNIN_CRONTAB >- then >- TMPFILE=`mktemp -t munin` || exit 1 >- cat > $TMPFILE >- crontab -u munin -l | sed -e "/^$b$/,/^$e$/d" | \ >- cat - $TMPFILE | crontab -u munin - >- rm $TMPFILE >- fi >- else >- crontab -u munin - >- fi >-} >- >-move_www_dir() { >- if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ] >- then >- echo Migrating ${PKG_PREFIX}/www/data/munin to ${PKG_PREFIX}/www/munin >- mv ${PKG_PREFIX}/www/data/munin ${PKG_PREFIX}/www/munin >- fi >-} >- >-move_newsyslog_conf() { >- oldfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-master >- newfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-master.conf >- samplefile=${PKG_PREFIX}/etc/munin/munin-master.newsyslog >- if [ -f ${oldfile} ]; then >- echo "Configuration file found in old location: ${oldfile}" >- if cmp -s ${samplefile} ${newfile} > /dev/null; then >- echo "Configuration file in new location has not been modified from the default: ${newfile}" >- echo " => Moving old configuration file to new location" >- mv -f ${oldfile} ${newfile} >- else >- echo "Configuration file in new location has been modified from the default: ${newfile}" >- echo " => Deleting old configuration file" >- rm ${oldfile} >- fi >- fi >-} >- >-######################################################################## >- >-case $2 in >- PRE-INSTALL) >- move_www_dir # at some point in the installation, the www dir is created >- ;; >- POST-INSTALL) >- if [ -z "${PACKAGE_BUILDING}" ] >- then >- create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT >-#BEGIN_MUNIN_MAIN >-MAILTO=root >- >-*/5 * * * * ${PKG_PREFIX}/bin/munin-cron >-#END_MUNIN_MAIN >-EOT >- fi >- move_newsyslog_conf >- ;; >-esac >diff --git a/sysutils/munin-master/pkg-plist b/sysutils/munin-master/pkg-plist >index 5b52eb6d3b94..15880da62343 100644 >--- a/sysutils/munin-master/pkg-plist >+++ b/sysutils/munin-master/pkg-plist >@@ -37,7 +37,9 @@ bin/munin-cron > @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 >+@dir etc/cron.d > @sample %%ETCDIR%%/munin-master.newsyslog etc/newsyslog.conf.d/munin-master.conf >+@sample %%ETCDIR%%/munin-master.cron etc/cron.d/munin-master.conf > %%SITE_PERL%%/Munin/Master/Config.pm > %%SITE_PERL%%/Munin/Master/GraphOld.pm > %%SITE_PERL%%/Munin/Master/Group.pm >diff --git a/sysutils/munin-node/files/pkg-message.in b/sysutils/munin-node/files/pkg-message.in >index 2042a1548601..f11aee556433 100644 >--- a/sysutils/munin-node/files/pkg-message.in >+++ b/sysutils/munin-node/files/pkg-message.in >@@ -27,23 +27,4 @@ to install the plugins automatically > EOT > type: install > } >-{ >-message: <<EOT >-The munin-node newsyslog.conf(5) filename has been changed: >- OLD: ${PREFIX}/etc/newsyslog.conf.d/munin-node >- NEW: ${PREFIX}/etc/newsyslog.conf.d/munin-node.conf >- >-Any file found at the old location has been automatically moved to >-the new location. This was done to ensure log rotation continued to >-work after change r340318 made to FreeBSD base, where the default >-newsyslog configuration now only includes filenames that end with >-'.conf' and do not begin with '.'. >- >-If you use provisioning/configuration management tools to create or >-edit this file, you will need to change their configuration to use >-the new filename. >-EOT >-type: upgrade >-maximum_version: "2.0.43_1" >-} > ] >diff --git a/sysutils/munin-node/pkg-install b/sysutils/munin-node/pkg-install >deleted file mode 100644 >index 71212351548e..000000000000 >--- a/sysutils/munin-node/pkg-install >+++ /dev/null >@@ -1,42 +0,0 @@ >-#! /bin/sh >- >-init_plugins() { >- if [ -f /tmp/.munin-node.version ]; then >- prevver=$(cat /tmp/.munin-node.version) >- fi >- >- if [ -n "$prevver" ]; then >- echo -n "Initializing new plugins.." >- ${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x >- fi >- echo "done." >-} >- >-move_newsyslog_conf() { >- oldfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-node >- newfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-node.conf >- samplefile=${PKG_PREFIX}/etc/munin/munin-node.newsyslog >- if [ -f ${oldfile} ]; then >- echo "Configuration file found in old location: ${oldfile}" >- if cmp -s ${samplefile} ${newfile} > /dev/null; then >- echo "Configuration file in new location has not been modified from the default: ${newfile}" >- echo " => Moving old configuration file to new location" >- mv -f ${oldfile} ${newfile} >- else >- echo "Configuration file in new location has been modified from the default: ${newfile}" >- echo " => Deleting old configuration file" >- rm ${oldfile} >- fi >- fi >-} >- >-######################################################################## >- >-case $2 in >- POST-INSTALL) >- if [ -z "${PACKAGE_BUILDING}" ]; then >- init_plugins >- fi >- move_newsyslog_conf >- ;; >-esac >-- >2.39.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 258072
: 239794