summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@gentoo.org>2015-09-16 10:31:00 -0500
committerDoug Goldstein <cardoe@gentoo.org>2015-09-16 10:31:20 -0500
commit5bab02093cfbe6ebcd22087520082604ae822379 (patch)
treef1ba0efd2115e56bff92adee32e6d911a0059864 /media-tv
parentwww-client/google-chrome-unstable: automated update (diff)
downloadgentoo-5bab02093cfbe6ebcd22087520082604ae822379.tar.gz
gentoo-5bab02093cfbe6ebcd22087520082604ae822379.tar.bz2
gentoo-5bab02093cfbe6ebcd22087520082604ae822379.zip
media-tv/mythtv: more refactors of the init script
Gentoo-Bug: 560142 Package-Manager: portage-2.2.20.1 Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
Diffstat (limited to 'media-tv')
-rw-r--r--media-tv/mythtv/files/mythbackend.init-r241
1 files changed, 22 insertions, 19 deletions
diff --git a/media-tv/mythtv/files/mythbackend.init-r2 b/media-tv/mythtv/files/mythbackend.init-r2
index aa7c35f27de2..6869eb5877f6 100644
--- a/media-tv/mythtv/files/mythbackend.init-r2
+++ b/media-tv/mythtv/files/mythbackend.init-r2
@@ -4,23 +4,27 @@
# $Id$
description="MythTV backend recording daemon"
-extra_commands="resched upnprebuild"
+extra_started_commands="resched upnprebuild"
description_resched="Forces the recording scheduler to update"
description_upnprebuild="Rebuilds the UPnP media cache"
+MYTHBACKEND_OPTS=${MYTHBACKEND_OPTS:-"${MYTHBACKEND_OPTS}"}
+MYTHBACKEND_VERBOSE=${MYTHBACKEND_VERBOSE:-"general"}
+MYTHBACKEND_LOGGING=${MYTHBACKEND_LOGGING:-"files"}
+
+name="MythTV backend"
+command="/usr/bin/mythbackend"
+pidfile="/run/mythtv/mythbackend.pid"
+start_stop_daemon_args="--pidfile ${pidfile} --user mythtv:video"
+command_args="--daemon --pidfile ${pidfile} --verbose ${MYTHBACKEND_VERBOSE} ${MYTHBACKEND_OPTS}"
+
depend() {
# mythbackend doesn't need to run on the same machine that
# mysql runs on. so its use for that reason
use logger net.lo mysql LCDd
}
-start() {
- local logging=
-
- [ -z "${MYTHBACKEND_VERBOSE}" ] && \
- MYTHBACKEND_VERBOSE="general"
- [ -z "${MYTHBACKEND_LOGGING}" ] && \
- MYTHBACKEND_LOGGING="files"
+start_pre() {
case "${MYTHBACKEND_LOGGING}" in
database) logging="--enable-dblog" ;;
syslog\ *) logging="--${MYTHBACKEND_LOGGING}" ;;
@@ -40,31 +44,30 @@ start() {
[ "x${MYTHBACKEND_LOGGING}" = "xfiles" ] && \
checkpath --directory --owner mythtv:video --mode 0775 /var/log/mythtv
checkpath --directory --owner mythtv:video --mode 0775 /home/mythtv
+ checkpath --directory --owner mythtv:video --mode 0750 /run/mythtv
+}
- ebegin "Starting MythTV Backend"
- start-stop-daemon --start --quiet --exec /usr/bin/mythbackend \
- --pidfile /var/run/mythbackend.pid --user mythtv:video -- \
- --daemon --pidfile /var/run/mythbackend.pid \
- --verbose ${MYTHBACKEND_VERBOSE} \
- ${logging} ${MYTHBACKEND_OPTS}
+start() {
+ ebegin "Starting ${name}"
+ start-stop-daemon --start ${start_stop_daemon_args} --exec ${command} \
+ -- ${command_args} ${logging}
eend $?
}
stop() {
- ebegin "Stopping MythTV Backend"
- start-stop-daemon --stop --retry 10 --progress \
- --pidfile=/var/run/mythbackend.pid
+ ebegin "Stopping ${name}"
+ start-stop-daemon --stop --retry 10 --progress --pidfile ${pidfile}
eend $?
}
resched() {
ebegin "Updating the recording scheduler"
- /usr/bin/mythbackend --resched
+ ${command} --resched
eend $?
}
upnprebuild() {
ebegin "Rebuilding UPnP media cache"
- /usr/bin/mythbackend --upnprebuild
+ ${command} --upnprebuild
eend $?
}