aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Smeets <flo@FreeBSD.org>2023-01-29 22:17:24 +0000
committerFlorian Smeets <flo@FreeBSD.org>2023-01-30 18:46:33 +0000
commit02388ae491f5d00fb4dfe7e1945b8644c3c1aae7 (patch)
tree7bafe092c917fae4bd0a09a985cce9bbd07c07d9
parent32a94e5a53a3d4691d556bec1cbe31f4f50b158f (diff)
downloadports-02388ae491f5d00fb4dfe7e1945b8644c3c1aae7.tar.gz
ports-02388ae491f5d00fb4dfe7e1945b8644c3c1aae7.zip
sysutils/munin-{master,node}: change cron job install
Don't rely on directly calling crontab(1) 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(1) 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(1) are removed. PR: 258072 Reported by: Tassilo Philipp <tphilipp@potion-studios.com> Tested by: Tassilo Philipp <tphilipp@potion-studios.com>
-rw-r--r--sysutils/munin-master/Makefile3
-rw-r--r--sysutils/munin-master/files/cron1
-rw-r--r--sysutils/munin-master/files/pkg-message.in22
-rw-r--r--sysutils/munin-master/pkg-install100
-rw-r--r--sysutils/munin-master/pkg-plist2
-rw-r--r--sysutils/munin-node/files/pkg-message.in19
-rw-r--r--sysutils/munin-node/pkg-install42
7 files changed, 6 insertions, 183 deletions
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