From 4c9de24d89797588160d7c1044e5642240135235 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Wed, 22 Jun 2011 00:50:07 +0100 Subject: [PATCH] Update ripping-cluster init script to run as media, included with ebuild --- media-video/ripping-cluster/Manifest | 4 ++- .../files/ripping-cluster-worker.confd | 5 ++++ .../files/ripping-cluster-worker.initd | 28 +++++++++++++++++++ ...ebuild => ripping-cluster-0.1.5-r1.ebuild} | 20 +++++++++++-- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 media-video/ripping-cluster/files/ripping-cluster-worker.confd create mode 100755 media-video/ripping-cluster/files/ripping-cluster-worker.initd rename media-video/ripping-cluster/{ripping-cluster-0.1.5.ebuild => ripping-cluster-0.1.5-r1.ebuild} (62%) diff --git a/media-video/ripping-cluster/Manifest b/media-video/ripping-cluster/Manifest index f4bdcdb..62644d3 100644 --- a/media-video/ripping-cluster/Manifest +++ b/media-video/ripping-cluster/Manifest @@ -1 +1,3 @@ -EBUILD ripping-cluster-0.1.5.ebuild 1215 RMD160 fee0e66c2e19d110e6b682282bc6bdd7c68ea35f SHA1 49541c40c398cebf520f7b8c6e01a6fb61c90909 SHA256 99b766ce322efc996235cdcbf6145dd9cff512e6f6ab73dd0acd7ea5f2357357 +AUX ripping-cluster-worker.confd 146 RMD160 a34878f83bd7d4ef178cf2ce83ddf3442eb9ecec SHA1 157b91fee4d303e6efaa5713a8047b2c761a4aed SHA256 0847dc873783571dd0f843c244c8d4340dcd622293e8016a3b1100b1e8bd11ea +AUX ripping-cluster-worker.initd 719 RMD160 6298829ed9af11d74a98ff65762965b84457396a SHA1 c5e9d5ab47c189c0b321353b9d88a2158ffc52b3 SHA256 a36d0ce123058fc836dd05c84463a7d35ec2dc84f89b0dd45ceadf3ea7bfc5c4 +EBUILD ripping-cluster-0.1.5-r1.ebuild 1796 RMD160 60c712e234c9626c9effa861accb42e2f5878938 SHA1 5152cc060ce658fa033f3da590bb4788a6cfc4f3 SHA256 1784eab14ad83267c908773b6f416e16843584e8ed0fae04def4136b1ab60035 diff --git a/media-video/ripping-cluster/files/ripping-cluster-worker.confd b/media-video/ripping-cluster/files/ripping-cluster-worker.confd new file mode 100644 index 0000000..631bdb7 --- /dev/null +++ b/media-video/ripping-cluster/files/ripping-cluster-worker.confd @@ -0,0 +1,5 @@ +# Which user to run the worker daemon as +USER="media" + +# File to store the running daemon's PID in +PID_FILE="/var/run/ripping-cluster-worker.pid" diff --git a/media-video/ripping-cluster/files/ripping-cluster-worker.initd b/media-video/ripping-cluster/files/ripping-cluster-worker.initd new file mode 100755 index 0000000..c1f4688 --- /dev/null +++ b/media-video/ripping-cluster/files/ripping-cluster-worker.initd @@ -0,0 +1,28 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount net + use dns logger puppetmaster netmount nfsmount +} + +start() { + ebegin "Starting ripping-cluster-worker" + start-stop-daemon --start --quiet \ + --background --make-pidfile --pidfile ${PID_FILE} \ + --chuid ${USER} --user ${USER} \ + --exec /usr/bin/php /usr/lib/ripping-cluster/worker/ripping-cluster-worker.php + eend $? "Failed to start ripping-cluster-worker" +} + +stop() { + ebegin "Stopping ripping-cluster-worker" + start-stop-daemon --stop --quiet \ + --pidfile ${PID_FILE} + local ret=$? + eend ${ret} "Failed to stop puppet" + rm -f ${PID_FILE} + return ${ret} +} + diff --git a/media-video/ripping-cluster/ripping-cluster-0.1.5.ebuild b/media-video/ripping-cluster/ripping-cluster-0.1.5-r1.ebuild similarity index 62% rename from media-video/ripping-cluster/ripping-cluster-0.1.5.ebuild rename to media-video/ripping-cluster/ripping-cluster-0.1.5-r1.ebuild index adfc16c..958bc30 100644 --- a/media-video/ripping-cluster/ripping-cluster-0.1.5.ebuild +++ b/media-video/ripping-cluster/ripping-cluster-0.1.5-r1.ebuild @@ -22,6 +22,7 @@ RDEPEND=">=dev-lang/php-5.3 >=dev-php/smarty-3.0 >=dev-libs/sihnon-php-lib-0.1 >=dev-php/PEAR-Net_Gearman-0.2.3 + >=media-video/handbrake-0.9 " DEPEND="${RDEPEND}" @@ -52,18 +53,33 @@ src_install() { doins -r worker fi - dodir /etc/ripping-cluster + keepdir /etc/ripping-cluster insinto /etc/ripping-cluster doins private/{config.php,dbconfig.conf}.dist - newinitd build/ripping-cluster-worker.init-gentoo ripping-cluster-worker + newinitd ${FILESDIR}/ripping-cluster-worker.initd ripping-cluster-worker + newconfd ${FILESDIR}/ripping-cluster-worker.confd ripping-cluster-worker + + keepdir /var/log/ripping-cluster + + fowners media /var/log/ripping-cluster } pkg_postinst() { elog "Please now edit config.php and dbconfig.conf." + elog "" + elog "This version does not come with database init scripts yet:" elog "You will need to create the database manually with this version" + elog "" + elog "The daemon will run as the user 'media' by default" + elog "Edit /etc/conf.d/ripping-cluster-worker to change this." + elog "" + elog "Start the daemon with:" + elog " /etc/init.d/ripping-cluster-worker start" + elog "Make the daemon start on boot with:" + elog " rc-update add ripping-cluster-worker default" }