mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
add mjpg-streamer
add myself as maintainer add UCI HTTP authentication Signed-off-by: Roger D <rogerdammit@gmail.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
config mjpg-streamer 'core'
|
||||
option enabled '0'
|
||||
option input 'uvc'
|
||||
option output 'http'
|
||||
option device '/dev/video0'
|
||||
option resolution '640x480'
|
||||
option fps '5'
|
||||
option www '/www/webcam'
|
||||
option port '8080'
|
||||
option username 'openwrt'
|
||||
option password 'openwrt'
|
||||
@@ -0,0 +1,10 @@
|
||||
case "$ACTION" in
|
||||
add)
|
||||
# start process
|
||||
/etc/init.d/mjpg-streamer start
|
||||
;;
|
||||
remove)
|
||||
# stop process
|
||||
/etc/init.d/mjpg-streamer stop
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2009-2013 OpenWrt.org
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/mjpg_streamer
|
||||
|
||||
error() {
|
||||
echo "${initscript}:" "$@" 1>&2
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local s="$1"
|
||||
|
||||
config_get_bool enabled "$1" 'enabled' 0
|
||||
[ $enabled -eq 0 ] && return
|
||||
|
||||
config_get input "$s" 'input'
|
||||
if [ -z "$input" ]; then
|
||||
error "in section '$s' option input is missing"
|
||||
return 1
|
||||
fi
|
||||
|
||||
config_get output "$s" 'output'
|
||||
if [ -z "$output" ]; then
|
||||
error "in section '$s' option output is missing"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local input_arg
|
||||
if [ "x$input" = 'xuvc' ]; then
|
||||
input_arg="input_uvc.so"
|
||||
|
||||
config_get device "$s" 'device'
|
||||
if [ ! -c "$device" ]; then
|
||||
error "device '$device' does not exist"
|
||||
return 1
|
||||
fi
|
||||
input_arg="${input_arg} --device $device"
|
||||
|
||||
config_get fps "$s" 'fps'
|
||||
[ -n "$fps" ] && input_arg="${input_arg} --fps $fps"
|
||||
|
||||
config_get resolution "$s" 'resolution'
|
||||
[ -n "$resolution" ] && input_arg="${input_arg} --resolution $resolution"
|
||||
fi
|
||||
|
||||
if [ -z "$input_arg" ]; then
|
||||
error "unsuported input option '$input' in section '$s'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local output_arg
|
||||
if [ "x$output" = 'xhttp' ]; then
|
||||
output_arg="output_http.so"
|
||||
|
||||
config_get port "$s" 'port'
|
||||
[ -n "$port" ] && output_arg="${output_arg} --port $port"
|
||||
|
||||
config_get www "$s" 'www'
|
||||
[ -n "$www" ] && output_arg="${output_arg} --www $www"
|
||||
|
||||
config_get username "$s" 'username'
|
||||
config_get password "$s" 'password'
|
||||
[ -n "$username" ] && [ -n "$password" ] && output_arg="${output_arg} --credentials $username:$password"
|
||||
fi
|
||||
|
||||
if [ -z "$output_arg" ]; then
|
||||
error "unsuported output option '$output' in section '$s'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" --input "$input_arg" --output "$output_arg"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load 'mjpg-streamer'
|
||||
config_foreach start_instance 'mjpg-streamer'
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'mjpg-streamer'
|
||||
}
|
||||
Reference in New Issue
Block a user