owsd: new version with rpcd init scripts

Signed-off-by: Mislav Novakovic <mislav.novakovic@sartura.hr>
This commit is contained in:
Mislav Novakovic 2016-02-05 21:30:18 +01:00 committed by Sukru Senli
parent f054fe34c1
commit bd0d992cf9
4 changed files with 73 additions and 4 deletions

View file

@ -12,8 +12,8 @@ PKG_VERSION:=0.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO=git
PKG_SOURCE_URL:=http://public.inteno.se/owsd.git
PKG_SOURCE_VERSION:=05eadc177ba8acf91a18caae2ea1a9a4247a9369
PKG_SOURCE_URL:=git@public.inteno.se:owsd.git
PKG_SOURCE_VERSION:=982bd1cb10c4acb78e36d45b0ef847afe714ec13
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>
@ -32,7 +32,8 @@ endef
define Package/owsd
$(call Package/$(PKG_NAME)/default)
TITLE += (default)
DEPENDS += +libwebsockets-nossl
DEPENDS += +libwebsockets-openssl
# DEPENDS += +libwebsockets-nossl
VARIANT:=owsd
endef
@ -61,7 +62,13 @@ endef
define Package/owsd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/owsd $(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
$(INSTALL_DIR) $(1)//usr/share/rpcd/acl.d
$(INSTALL_BIN) ./files/superuser.json $(1)/usr/share/rpcd/acl.d/superuser.json
endef
$(eval $(call BuildPackage,owsd))

7
owsd/files/owsd Normal file
View file

@ -0,0 +1,7 @@
config owsd 'setup'
option sock '/var/run/ubus.sock'
option port '8843'
list origin 'http://localhost/'
list origin 'http://localhost:80/'
list origin 'http://localhost:8080/'

38
owsd/files/owsd.init Normal file
View file

@ -0,0 +1,38 @@
#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
PROG=/usr/bin/owsd
CONFIGFILE="/etc/config/owsd"
validate_owsd() {
uci_validate_section owsd config setup \
'sock:string' \
'port:string' \
'origin:string'
}
start_service() {
procd_open_instance
procd_set_param command $PROG
validate_owsd || {
echo "validation failed"
return 1
}
[ -n "${port}" ] || return 0
origin=${origin//\ / \-o\ }
procd_append_param command -s ${sock} -p ${port} -o ${origin}
procd_set_param respawn
procd_close_instance
}
stop_service()
{
service_stop ${PROG}
}

17
owsd/files/superuser.json Normal file
View file

@ -0,0 +1,17 @@
{
"superuser": {
"description": "Super user access role",
"read": {
"ubus": {
"*": [ "*" ]
},
"uci": [ "*" ]
},
"write": {
"ubus": {
"*": [ "*" ]
},
"uci": [ "*" ]
}
}
}