Merge pull request #8189 from jefferyto/rtty-init

rtty: Update init script
This commit is contained in:
Rosen Penev 2019-04-14 23:39:38 -07:00 committed by GitHub
commit 6326b48d4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 41 deletions

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=rtty
PKG_VERSION:=6.5.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=v$(PKG_VERSION)

View file

@ -5,13 +5,8 @@ START=99
BIN=/usr/sbin/rtty
start_rtty() {
. /lib/functions/network.sh
local cfg="$1"
local interface ifname id description host port ssl
uci_validate_section rtty rtty "${1}" \
validate_rtty_section() {
uci_load_validate rtty rtty "$1" "$2" \
'interface:uci("network", "@interface"):lan' \
'id:maxlength(63)' \
'description:maxlength(126)' \
@ -19,8 +14,14 @@ start_rtty() {
'port:port' \
'ssl:bool:0' \
'keepalive:uinteger:5'
}
[ $? -ne 0 ] && {
start_rtty() {
. /lib/functions/network.sh
local ifname
[ "$2" = 0 ] || {
echo "validation failed" >&2
return 1
}
@ -54,6 +55,10 @@ start_rtty() {
start_service() {
config_load rtty
config_foreach start_rtty rtty
config_foreach validate_rtty_section rtty start_rtty
}
service_triggers() {
procd_add_reload_trigger "rtty"
procd_add_validation validate_rtty_section
}