Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=9c6a47431f2ccd05c86ad5ca1b3c3d0f564bddf5

commit 9c6a47431f2ccd05c86ad5ca1b3c3d0f564bddf5
Author: James Buren <[email protected]>
Date:   Mon Jul 30 10:16:39 2012 -0500

munin-node-1.2.6-13-x86_64
* convert to systemd schema

diff --git a/source/network-extra/munin-node/FrugalBuild 
b/source/network-extra/munin-node/FrugalBuild
index 9d73330..f9c8bf0 100644
--- a/source/network-extra/munin-node/FrugalBuild
+++ b/source/network-extra/munin-node/FrugalBuild
@@ -4,7 +4,7 @@

pkgname=munin-node
pkgver=1.2.6
-pkgrel=12
+pkgrel=13
pkgdesc="Munin is a tool for graphing all sorts of information about one or 
more servers and displaying it in a web interface. (Node)"
_F_sourceforge_name="munin"
_F_sourceforge_dirname="munin"
@@ -15,15 +15,20 @@ depends=('perl-net-server')
groups=('network-extra')
archs=('i686' 'x86_64')
up2date="lynx -dump $url|grep 'Stable'|sed 's/.*: \(.*\)\ .*D.*/\1/'"
-source=($source Makefile.config rc.munin-node munin-node.logrotate 
munin-node.conf)
+source=($source Makefile.config rc.munin-node munin-node.service 
munin-node.logrotate munin-node.conf)
sha1sums=('bdc6d1767df1ea618071d76f0c4525dda2ea33d9' \
'1ef1cef662f90e0177a67655afb020bf856235b8' \
'd84a72d5365aa1e1c77854310af0d07b7031693d' \
+          'fee509af81baeebe9ecb309943afbbab8aed0335' \
'2950e0a37d42abb2b152a40f24498982613a4b62' \
'30389dab21fbffdbdab52f7aacf3eb63b9e32ef9')
options=('scriptlet')
backup=(etc/munin/{munin-node.conf,plugin-conf.d/munin-node})
removes=('usr/lib/perl5/site_perl/current/Munin/Plugin.pm')
+_F_systemd_scriptlet="$pkgname.install"
+_F_sysvinit_units=(munin-node)
+_F_systemd_units=(munin-node=)
+Finclude systemd

build()
{
@@ -55,6 +60,8 @@ d $Flocalstatedir/run/munin 0755 munin munin -
EOF
Fdirschown /var/log/munin 47 47
Fdirschown /var/lib/munin 47 47
+       Ffile /lib/systemd/system/munin-node.service
+       Fgenscriptlet
}

# optimization OK
diff --git a/source/network-extra/munin-node/munin-node.install 
b/source/network-extra/munin-node/munin-node.install
index 88ebe8f..4291458 100644
--- a/source/network-extra/munin-node/munin-node.install
+++ b/source/network-extra/munin-node/munin-node.install
@@ -1,3 +1,6 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
post_install()
{
if ! grep -q '^munin:' /etc/group ; then
@@ -9,6 +12,35 @@ post_install()

# init plugins
munin-node-configure --shell 2>/dev/null | sh
+
+       local unit
+       local op
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               op=$(echo $i | cut -f 2 -d '=')
+               if echo $op | grep -q 'e'; then
+                       systemctl enable $unit.service >/dev/null 2>&1
+               fi
+               if echo $op | grep -q 's'; then
+                       systemctl start $unit.service >/dev/null 2>&1
+               fi
+       done
+}
+
+post_upgrade()
+{
+       munin-node-configure --shell --newer "${0%-*}" | sh
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       systemctl daemon-reload >/dev/null 2>&1
}

pre_remove()
@@ -18,6 +50,18 @@ pre_remove()
rm $plugin
fi
done
+
+       local unit
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               systemctl --no-reload disable $unit.service >/dev/null 2>&1
+               systemctl stop $unit.service >/dev/null 2>&1
+       done
}

post_remove()
@@ -31,15 +75,10 @@ post_remove()
# delete dangling symlinks
rm -f /var/lib/munin/plugin-state/*.state
rm -f /var/log/munin/munin-node.log*
-}

-post_upgrade()
-{
-       munin-node-configure --shell --newer "${0%-*}" | sh
+       systemctl daemon-reload >/dev/null 2>&1
}

op=$1
shift
$op $*
-
-# vim: ft=sh
diff --git a/source/network-extra/munin-node/munin-node.service 
b/source/network-extra/munin-node/munin-node.service
new file mode 100644
index 0000000..10db8ee
--- /dev/null
+++ b/source/network-extra/munin-node/munin-node.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Munin Node Daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/munin-node
+PIDFile=/var/run/munin/munin-node.pid
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to