aboutsummaryrefslogtreecommitdiffstats
path: root/community/omxplayer/omxplayer.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-03-07 13:56:09 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-03-07 13:56:09 +0000
commit69e0f45f2280af0ef8e2f192363ebd3bfbc42eb3 (patch)
tree08dd1ffea0bdd6d5e425290ce7aee76efba37d46 /community/omxplayer/omxplayer.initd
parent26aa4de397292ac7cf30da476e1909e4129f340b (diff)
downloadaports-69e0f45f2280af0ef8e2f192363ebd3bfbc42eb3.tar.bz2
aports-69e0f45f2280af0ef8e2f192363ebd3bfbc42eb3.tar.xz
{main => community}/omxplayer: move
Diffstat (limited to 'community/omxplayer/omxplayer.initd')
-rw-r--r--community/omxplayer/omxplayer.initd34
1 files changed, 34 insertions, 0 deletions
diff --git a/community/omxplayer/omxplayer.initd b/community/omxplayer/omxplayer.initd
new file mode 100644
index 0000000000..70af0e56da
--- /dev/null
+++ b/community/omxplayer/omxplayer.initd
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+
+depend() {
+ after net firewall chrony
+}
+
+omxplayer_run_loop() {
+ while true; do
+ /usr/bin/omxplayer "$@"
+ status=$?
+ echo "exited: $status"
+ [ "$status" -eq 129 ] && exit 0
+ [ "$status" -ne 0 ] && sleep ${OMXPLAYER_DELAY:-5}
+ done
+}
+
+checkconfig() {
+ [ -z "$OMXPLAYER_URL" ] && eerror "omxplayer URL not set"
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting omxplayer"
+ omxplayer_run_loop ${OMXPLAYER_OPTS} "${OMXPLAYER_URL}" 2>&1 | logger -t omxplayer &
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping omxplayer"
+ killall -HUP omxplayer
+ eend $?
+}
+