diff options
author | sem <sem@FreeBSD.org> | 2005-03-05 01:47:19 +0800 |
---|---|---|
committer | sem <sem@FreeBSD.org> | 2005-03-05 01:47:19 +0800 |
commit | ba1cc50ea10162a705c4e64928772785ae2c33c1 (patch) | |
tree | cf8b0c9be2863ad75d6d0c19e14b6176689adefb /sysutils/munin-node/pkg-deinstall | |
parent | c2da15a63cde92de81dffaf594b0c80c6bd2e815 (diff) | |
download | freebsd-ports-gnome-ba1cc50ea10162a705c4e64928772785ae2c33c1.tar.gz freebsd-ports-gnome-ba1cc50ea10162a705c4e64928772785ae2c33c1.tar.zst freebsd-ports-gnome-ba1cc50ea10162a705c4e64928772785ae2c33c1.zip |
- Update tp 1.2.0
- Upgrade FreeBSD4 support to rcNG
- Use INSTALL_SCRIPT to install the start-stop script
- Correct rcNG version of pkg-message, adding PREFIX
- Use SUB_FILES and SUB_LIST
- Add log rotation support
PR: ports/77721
Submitted by: maintainer
Diffstat (limited to 'sysutils/munin-node/pkg-deinstall')
-rw-r--r-- | sysutils/munin-node/pkg-deinstall | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/sysutils/munin-node/pkg-deinstall b/sysutils/munin-node/pkg-deinstall index 54e8e509cd30..3bf91c5a0e5b 100644 --- a/sysutils/munin-node/pkg-deinstall +++ b/sysutils/munin-node/pkg-deinstall @@ -1,13 +1,4 @@ #! /bin/sh -# -# $Log: pkg-deinstall,v $ -# Revision 1.2.2.1 2004/11/21 10:52:27 lupe -# make stop_process use old or new start-stop script. -# -# Revision 1.2 2004/02/06 18:49:58 lupe -# Fixes for pkg_add compatibility. -# -# ask() { local question default answer @@ -39,6 +30,8 @@ yesno() { } stop_process() { + STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node.sh + if [ -x $STARTSTOP ]; then $STARTSTOP stop fi @@ -54,17 +47,45 @@ delete_group() { fi } -OSVERSION=`/sbin/sysctl -n kern.osreldate` -if [ $OSVERSION -lt 500000 ]; then - STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node.sh -else - STARTSTOP=/etc/rc.d/munin_node -fi +delete_crontab_entries() { + local prog + prog=$1 + + if grep -q "^[^#]*$prog" /etc/crontab; then + TMPFILE=`mktemp -t munin` || exit 1 + grep -v $prog /etc/crontab > $TMPFILE + cat $TMPFILE > /etc/crontab + rm $/etc/crontab + fi +} + +delnewsyslog() { + tmp="/etc/#munin-node$$" + sed -e '/^\/var\/log\/munin-node.log[ ]/d' /etc/newsyslog.conf >${tmp} + cat ${tmp} > /etc/newsyslog.conf + rm ${tmp} +} + +newsyslog() { + ENTRY=`grep /var/log/munin-node.log /etc/newsyslog.conf` + DEFAULT='/var/log/munin-node.log 644 7 * @T00 Z /var/run/munin/munin-node.pid' + if [ -z "$ENTRY" ]; then + exit 0 + elif [ "$ENTRY" = "$DEFAULT" ]; then + delnewsyslog + elif yesno "You have changed the default munin-node entry in \"/etc/newsyslog.conf\". +Do you want me to delete it?" y; then + delnewsyslog + echo "Done." + fi +} + case $2 in DEINSTALL) + delete_crontab_entries ${PKG_PREFIX}/bin/munin-node-revive stop_process - exit 0 # ignore error + newsyslog ;; POST-DEINSTALL) delete_group munin |