You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.0 KiB

#!/bin/sh /etc/rc.common
# Copyright (C) 2014 OpenWrt.org
NAME=upmpdcli
START=95
UPMPD_BIN=/usr/bin/${NAME}
USE_PROCD=1
append_arg() {
local cfg="$1"
local var="$2"
local opt="$3"
local def="$4"
local val
config_get val "$cfg" "$var"
[ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
}
start_instance() {
local cfg="$1"
local interface
procd_open_instance
procd_set_param command "${UPMPD_BIN}"
# config_get interface "$cfg" interface
# procd_add_reload_interface_trigger $interface
append_arg "$cfg" interface "-i"
append_arg "$cfg" mpd_host "-h"
append_arg "$cfg" mpd_port "-p"
append_arg "$cfg" upmpd_port "-P"
append_arg "$cfg" config "-c"
append_arg "$cfg" friendly_name "-f"
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "${NAME}"
}
start_service() {
config_load ${NAME}
config_foreach start_instance ${NAME}
}