olli 3ce08b93c8 [packages] multimedia/uvc-streamer: Actually use the start-stop-daemon. Seems the Busybox SSD works with multiple PIDs now.
git-svn-id: svn://svn.openwrt.org/openwrt/packages@12679 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-09-24 10:16:27 +00:00

52 lines
1.0 KiB
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=50
SSD=start-stop-daemon
NAME=uvc_streamer
PIDF=/var/run/$NAME.pid
PROG=/sbin/$NAME
append_bool() {
local section="$1"
local option="$2"
local value="$3"
local _val
config_get_bool _val "$section" "$option" '0'
[ "$_val" -gt 0 ] && append args "$3"
}
append_string() {
local section="$1"
local option="$2"
local value="$3"
local _val
config_get _val "$section" "$option"
[ -n "$_val" ] && append args "$3 $_val"
}
start_service() {
local section="$1"
args=""
append_string "$section" device "-d"
append_string "$section" resolution "-r"
append_bool "$section" framespersecond "-f"
append_string "$section" port "-p"
config_get_bool "enabled" "$section" "enabled" '1'
[ "$enabled" -gt 0 ] && sleep 5s && $SSD -S -p $PIDF -q -x $PROG -- -b $args &
}
stop_service() {
$SSD -K -p $PIDF
}
start() {
config_load "uvc-streamer"
config_foreach start_service "uvc-streamer"
}
stop() {
config_load "uvc-streamer"
config_foreach stop_service "uvc-streamer"
}