Update ripping-cluster init script to run as media, included with ebuild

This commit is contained in:
2011-06-22 00:50:07 +01:00
parent ee9fae313b
commit 4c9de24d89
4 changed files with 54 additions and 3 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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}
}

View File

@@ -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"
}