mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
owsd: update to new version with multiple ports
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
This commit is contained in:
parent
ea2abe2723
commit
543baa4e04
4 changed files with 61 additions and 34 deletions
|
|
@ -8,16 +8,17 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=owsd
|
||||
PKG_VERSION:=0.94
|
||||
PKG_VERSION:=0.97
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO=git
|
||||
PKG_SOURCE_URL:=git@public.inteno.se:owsd.git
|
||||
PKG_SOURCE_VERSION:=18825d54a38d137fb26f418d1d2f7bb2991eaf89
|
||||
PKG_SOURCE_VERSION:=40487a5d2d6541451095b9afcb23fd0d8395fde2
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
||||
PKG_MAINTAINER:=Sartura Support for Inteno <support-inteno@sartura.hr>
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
|
@ -29,6 +30,15 @@ define Package/owsd
|
|||
TITLE:=owsd daemon
|
||||
endef
|
||||
|
||||
define Package/owsd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owsd $(1)/usr/bin/owsd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/owsd.init $(1)/etc/init.d/owsd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/owsd.config $(1)/etc/config/owsd
|
||||
endef
|
||||
|
||||
define Package/owsd-testdata
|
||||
$(call Package/owsd)
|
||||
TITLE += (Test certs and rpcd ACLs for running automated tests)
|
||||
|
|
@ -71,14 +81,5 @@ uci delete rpcd.owsd_test
|
|||
uci commit
|
||||
endef
|
||||
|
||||
define Package/owsd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/owsd $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/owsd.init $(1)/etc/init.d/owsd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/owsd $(1)/etc/config/owsd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,owsd))
|
||||
$(eval $(call BuildPackage,owsd-testdata))
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
config owsd 'setup'
|
||||
#option sock '/var/run/ubus.sock'
|
||||
#option port '8843'
|
||||
list origin 'http://192.168.1.1:8843'
|
||||
list origin 'https://192.168.1.1:8843'
|
||||
#option cert '/usr/share/owsD/cert.pem'
|
||||
#option key '/usr/share/owsD/key.pem'
|
||||
#option www '/www'
|
||||
|
||||
15
owsd/files/owsd.config
Normal file
15
owsd/files/owsd.config
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
config owsd 'global'
|
||||
option sock '/var/run/ubus.sock'
|
||||
option www '/www'
|
||||
|
||||
config owsd-listen 'lan'
|
||||
option port '8880'
|
||||
option interface 'br-lan'
|
||||
# option whitelist_interface_as_origin '1'
|
||||
|
||||
#config owsd-listen 'lan-https'
|
||||
# option port '4443'
|
||||
# option interface 'br-lan'
|
||||
# option whitelist_interface_as_origin '1'
|
||||
# option cert ''
|
||||
# option key ''
|
||||
|
|
@ -8,36 +8,56 @@ PROG=/usr/bin/owsd
|
|||
CONFIGFILE="/etc/config/owsd"
|
||||
|
||||
validate_owsd() {
|
||||
uci_validate_section owsd config setup \
|
||||
uci_validate_section "owsd" "owsd" "global" \
|
||||
'sock:string' \
|
||||
'port:integer' \
|
||||
'origin:list(string)' \
|
||||
'cert:string' \
|
||||
'key:string' \
|
||||
'www:string' \
|
||||
|
||||
'www:string'
|
||||
}
|
||||
|
||||
append_origin() {
|
||||
procd_append_param command -o "$1"
|
||||
}
|
||||
|
||||
validate_owsd_iface() {
|
||||
uci_validate_section "owsd" "owsd-listen" "$1" \
|
||||
'port:port' \
|
||||
'interface:string' \
|
||||
'origin:list(string)' \
|
||||
'cert:string' \
|
||||
'key:string'
|
||||
}
|
||||
|
||||
parse_owsd_iface() {
|
||||
local port interface cert key
|
||||
|
||||
validate_owsd_iface "$1" || {
|
||||
echo "Validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "${port}" ] && procd_append_param command -p "${port}"
|
||||
[ -n "${interface}" ] && procd_append_param command -i "${interface}"
|
||||
[ -n "${cert}" ] && procd_append_param command -c "${cert}"
|
||||
[ -n "${key}" ] && procd_append_param command -k "${key}"
|
||||
|
||||
config_list_foreach "$1" "origin" append_origin
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load owsd
|
||||
procd_open_instance
|
||||
procd_set_param command $PROG
|
||||
|
||||
local sock www
|
||||
|
||||
validate_owsd || {
|
||||
echo "validation failed"
|
||||
echo "Global validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "${sock}" ] && procd_append_param command -s "${sock}"
|
||||
[ -n "${port}" ] && procd_append_param command -p "${port}"
|
||||
config_list_foreach "setup" "origin" append_origin
|
||||
[ -n "${cert}" ] && procd_append_param command -c "${cert}"
|
||||
[ -n "${key}" ] && procd_append_param command -k "${key}"
|
||||
[ -n "${www}" ] && procd_append_param command -w "${www}"
|
||||
[ -n "${sock}" ] && procd_append_param command -s "${sock}"
|
||||
[ -n "${www}" ] && procd_append_param command -w "${www}"
|
||||
|
||||
config_foreach parse_owsd_iface "owsd-listen"
|
||||
|
||||
# procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue