Skip to content

Instantly share code, notes, and snippets.

@joschi

joschi/PGKBUILD Secret

Created November 20, 2012 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joschi/721dfbc08af3385553c3 to your computer and use it in GitHub Desktop.
Save joschi/721dfbc08af3385553c3 to your computer and use it in GitHub Desktop.
mcollective 2.2.1-1
#!/bin/sh
#
# mcollective Application Server for STOMP based agents
#
# chkconfig: 345 24 76
#
# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
# much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
# as a bonus.
#
### BEGIN INIT INFO
# Provides: mcollective
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
mcollectived="/usr/sbin/mcollectived"
# Lockfile
if [ -d /var/lock/subsys ]; then
# RedHat/CentOS/etc who use subsys
lock="/var/lock/subsys/mcollective"
else
# The rest of them
lock="/var/lock/mcollective"
fi
# PID directory
pidfile="/var/run/mcollectived.pid"
# Source function library.
. /lib/lsb/init-functions
# Check that binary exists
if ! [ -f $mcollectived ]
then
echo "mcollectived binary not found"
exit 0
fi
# See how we were called.
case "$1" in
start)
echo -n "Starting mcollective: "
if [ -f ${lock} ]; then
# we were not shut down correctly
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}` >/dev/null 2>&1
fi
rm -f ${pidfile}
rm -f ${lock}
sleep 2
fi
rm -f ${pidfile}
${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg"
if [ $? = 0 ]; then
log_success_msg
touch $lock
exit 0
else
log_failure_msg
exit 1
fi
;;
stop)
echo -n "Shutting down mcollective: "
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}` >/dev/null 2>&1
fi
rm -f ${pidfile}
log_success_msg
rm -f $lock
;;
restart)
$0 stop
sleep 2
$0 start
;;
condrestart)
if [ -f $lock ]; then
$0 stop
# avoid race
sleep 2
$0 start
fi
;;
status)
if [ -f ${lock} ]; then
if [ -s ${pidfile} ]; then
if [ -e /proc/`cat ${pidfile}` ]; then
echo "mcollectived (`cat ${pidfile}`) is running"
exit 0
else
echo "mcollectived (`cat ${pidfile}`) is NOT running"
exit 1
fi
fi
else
echo "mcollectived: service not started"
exit 1
fi
;;
force-reload)
echo "not implemented"
;;
*)
echo "Usage: mcollectived {start|stop|restart|condrestart|status}"
exit 1
;;
esac
exit 0
# Maintainer: Alexander Baldeck <kth5@archlinuxppc.org>
# Contributor: Jochen Schalanda <jochen+aur@schalanda.name>
pkgname=mcollective
pkgver=2.2.1
pkgrel=1
pkgdesc="Framework to build server orchestration or parallel job execution systems"
arch=(any)
url="http://www.puppetlabs.com/mcollective/"
license=('APACHE')
depends=('ruby>=1.9' 'ruby-stomp' 'ruby-systemu')
source=(http://puppetlabs.com/downloads/mcollective/${pkgname}-${pkgver}.tgz
mcollective.init)
md5sums=('f36b754a4f874525d1f4be31e1e4da4a'
'eded4e2a755bb05cbe0a2a52ec84b4c9')
build() {
cd "${srcdir}/${pkgname}-$pkgver"
install -d -m0755 ${pkgdir}/usr/lib/ruby/site_ruby/mcollective
install -d -m0755 ${pkgdir}/usr/bin
install -d -m0755 ${pkgdir}/usr/sbin
install -d -m0755 ${pkgdir}/etc/init.d
install -d -m0755 ${pkgdir}/usr/libexec/mcollective/
install -d -m0755 ${pkgdir}/etc/mcollective
install -d -m0755 ${pkgdir}/etc/mcollective/plugin.d
install -d -m0755 ${pkgdir}/etc/mcollective/ssl
install -d -m0755 ${pkgdir}/etc/mcollective/ssl/clients
install -m0755 bin/mcollectived ${pkgdir}/usr/sbin/mcollectived
install -m0755 bin/mc-call-agent ${pkgdir}/usr/sbin/mc-call-agent
install -m0755 bin/mco ${pkgdir}/usr/sbin/mco
install -m0640 etc/server.cfg.dist ${pkgdir}/etc/mcollective/server.cfg
install -m0644 etc/client.cfg.dist ${pkgdir}/etc/mcollective/client.cfg
install -m0444 etc/facts.yaml.dist ${pkgdir}/etc/mcollective/facts.yaml
install -m0444 etc/rpc-help.erb ${pkgdir}/etc/mcollective/rpc-help.erb
install -D -m0755 ${srcdir}/mcollective.init ${pkgdir}/etc/rc.d/mcollective
cp -R lib/* ${pkgdir}/usr/lib/ruby/site_ruby/
cp -R plugins/* ${pkgdir}/usr/libexec/mcollective/
}
# vim:set ts=2 sw=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment