mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
sulu: Separate packages for plugins
- Check Readme.md for details
This commit is contained in:
parent
3cd58f18cc
commit
9e65220253
29 changed files with 325 additions and 1050 deletions
|
|
@ -1,126 +0,0 @@
|
|||
menu "Configuration"
|
||||
depends on PACKAGE_sulu-builder
|
||||
|
||||
menu "SULU_CORE"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_CORE_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_CORE_URL
|
||||
string "SULU url"
|
||||
default "https://dev.iopsys.eu/websdk/sulu.git"
|
||||
|
||||
config SULU_CORE_VERSION
|
||||
string "SULU repo version"
|
||||
default "1f3ca1d102c3512c5f9bf7a41aab0ca1b0b9bb8a"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_LCM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_LCM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_LCM_NAME
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-lcm"
|
||||
|
||||
config SULU_PLUGIN_LCM_URL
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-lcm.git"
|
||||
|
||||
config SULU_PLUGIN_LCM_VERSION
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Version"
|
||||
default "b3f6028fd168e58b93ae56f616e96712849c656a"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_MULTIAP"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_MULTIAP_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_NAME
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-multi-ap"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_URL
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-multi-ap.git"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_VERSION
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Version"
|
||||
default "1eca5af280789cef3feeeb4d296ed01f87b15bb0"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_IOPSYS"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_IOPSYS_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_THEME_IOPSYS_NAME
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-theme-iopsys"
|
||||
|
||||
config SULU_THEME_IOPSYS_URL
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-theme-iopsys.git"
|
||||
|
||||
config SULU_THEME_IOPSYS_VERSION
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Version"
|
||||
default "e80fea80cdf8d49db0ae70b5c26a5dab49b8a20d"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_NAME
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "custom_app"
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_URL
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_VERSION
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_THEME_CUSTOM_NAME
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "plugin_theme_custom"
|
||||
|
||||
config SULU_THEME_CUSTOM_URL
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_THEME_CUSTOM_VERSION
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
endmenu
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2021-2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=1.3.30
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=a64f09fb882a1d90ccfe2fdec0ddf337788eef54
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/${PKG_NAME}
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Build sulu from source
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
CONFLICTS:=sulu
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/description
|
||||
SULU-CE ReactJS based Web UI builder.
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
# Sulu core and other dependent needs to be updated in Config.in
|
||||
SULU_DL_FILE:=sulu_core-${CONFIG_SULU_CORE_VERSION}.tar.gz
|
||||
define Download/sulu_core
|
||||
FILE:=$(SULU_DL_FILE)
|
||||
URL:=$(CONFIG_SULU_CORE_URL)
|
||||
PROTO:=git
|
||||
SUBDIR:=sulu
|
||||
VERSION:=${CONFIG_SULU_CORE_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_CORE_ENABLE),y)
|
||||
$(eval $(call Download,sulu_core))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_LCM_DL:=${CONFIG_SULU_PLUGIN_LCM_NAME}_plugin-${CONFIG_SULU_PLUGIN_LCM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_lcm
|
||||
FILE:=${SULU_PLUGIN_LCM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_LCM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_LCM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_LCM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_lcm))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_MULTIAP_DL:=${CONFIG_SULU_PLUGIN_MULTIAP_NAME}_plugin-${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_multiap
|
||||
FILE:=${SULU_PLUGIN_MULTIAP_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_MULTIAP_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_MULTIAP_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_multiap))
|
||||
endif
|
||||
|
||||
SULU_THEME_IOPSYS_DL:=${CONFIG_SULU_THEME_IOPSYS_NAME}_plugin-${CONFIG_SULU_THEME_IOPSYS_VERSION}.tar.gz
|
||||
define Download/sulu_theme_iopsys
|
||||
FILE:=${SULU_THEME_IOPSYS_DL}
|
||||
URL:=${CONFIG_SULU_THEME_IOPSYS_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_IOPSYS_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_IOPSYS_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_iopsys))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_CUSTOM_DL:=${CONFIG_SULU_PLUGIN_CUSTOM_NAME}_plugin-${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_custom
|
||||
FILE:=${SULU_PLUGIN_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_custom))
|
||||
endif
|
||||
|
||||
SULU_THEME_CUSTOM_DL:=${CONFIG_SULU_THEME_CUSTOM_NAME}_plugin-${CONFIG_SULU_THEME_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_theme_custom
|
||||
FILE:=${SULU_THEME_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_THEME_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_custom))
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
tar xzf $(DL_DIR)/${SULU_DL_FILE} -C $(PKG_BUILD_DIR)
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_LCM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_MULTIAP_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_IOPSYS_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
VERSION="v${PKG_VERSION}" $(MAKE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/install
|
||||
$(INSTALL_DIR) $(1)/sulu
|
||||
$(INSTALL_DIR) $(1)/sulu/config
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/
|
||||
$(INSTALL_DIR) $(1)/etc/mosquitto/conf.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,${PKG_NAME}))
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_nginx_uci()
|
||||
{
|
||||
uci_load nginx
|
||||
|
||||
if ! uci_get nginx _sulu_s >/dev/null 2>&1; then
|
||||
uci_add nginx server _sulu_s
|
||||
uci_set nginx _sulu_s root '/sulu'
|
||||
uci_add_list nginx _sulu_s listen "8443 http2 ssl"
|
||||
uci_add_list nginx _sulu_s listen "[::]:8443 http2 ssl"
|
||||
uci_set nginx _sulu_s server_name '_sulu_s'
|
||||
uci_add_list nginx _sulu_s include 'restrict_locally'
|
||||
uci_add_list nginx _sulu_s include '/etc/sulu/nginx.locations'
|
||||
uci_set nginx _sulu_s uci_manage_ssl 'self-signed'
|
||||
uci_set nginx _sulu_s ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set nginx _sulu_s ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set nginx _sulu_s ssl_session_cache 'shared:SSL:32k'
|
||||
uci_set nginx _sulu_s ssl_session_timeout '64m'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
fi
|
||||
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
uci_add nginx server _suluredirect
|
||||
uci_add_list nginx _suluredirect listen "8080"
|
||||
uci_add_list nginx _suluredirect listen "[::]:8080"
|
||||
uci_set nginx _suluredirect server_name '_suluredirect'
|
||||
uci_set nginx _suluredirect return 'https://$host:8443$request_uri'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_nginx_uci
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2021-2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu
|
||||
PKG_VERSION:=1.3.30
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=a64f09fb882a1d90ccfe2fdec0ddf337788eef54
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_RELEASE=$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sulu
|
||||
SECTION:=sulu
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=SULU-CE ReactJS based Web UI Package
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
SULU-CE ReactJS based Web UI.
|
||||
endef
|
||||
|
||||
define Package/sulu/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/config/*.json $(1)/sulu/config
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
|
||||
56
sulu/Readme.md
Normal file
56
sulu/Readme.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# SULU-CE
|
||||
SULU is a ReactJS based USP controller, for more details please check sulu [documentation](https://dev.iopsys.eu/websdk/sulu/-/blob/devel/README.md). This directory contains the recipes to build sulu for IOWRT.
|
||||
|
||||
SULU has two variants
|
||||
1. sulu - This package usages the prebuilt distribution, so it faster but only include iopsys default packages
|
||||
2. sulu-builder - This package builds the sulu along with selected plugins from source
|
||||
|
||||
# Directory structure
|
||||
This directory contains iowrt sulu plugins packages along with sulu builder.
|
||||
|
||||
- sulu-builder - Offers sulu and sulu-builder iowrt packages
|
||||
- sulu-base - Sulu core source, needed for sulu-builder
|
||||
- sulu-lcm - Sulu plugin for Life Cycle Management, can be used with sulu-builder
|
||||
- sulu-multi-ap - Sulu plugin for Multi-AP, can be used with sulu-builder
|
||||
- sulu-parental-control - Sulu plugin for Parental control, can be used with sulu-builder
|
||||
- sulu-theme-iopsys - Sulu example theme plugin, can be used with sulu-builder
|
||||
|
||||
User can select 'CONFIG_PACKAGE_sulu=y' to use the sulu prebuilt distribution, or can select 'CONFIG_PACKAGE_sulu-builder=y' to build sulu along with customized plugins.
|
||||
|
||||
# How to select a sulu plugins
|
||||
While building sulu from source, user has to select the all plugins they want to include in sulu, which can be done with 'make menuconfig', below are the list of sulu plugins available currently.
|
||||
```bash
|
||||
# CONFIG_PACKAGE_sulu-lcm is not set
|
||||
# CONFIG_PACKAGE_sulu-multi-ap is not set
|
||||
# CONFIG_PACKAGE_sulu-parental-control is not set
|
||||
# CONFIG_PACKAGE_sulu-theme-iopsys is not set
|
||||
```
|
||||
|
||||
# How to add a new sulu plugin
|
||||
User can also add there own sulu plugins as package with a simple makefile as below:
|
||||
|
||||
```bash
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=<Name of plugin>
|
||||
PKG_VERSION:=<Plugin version number>
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=<Plugin url>
|
||||
PKG_SOURCE_VERSION:=<Plugin version hash to use>
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
endef
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
```
|
||||
|
||||
In the above example makefile, if user need to install any plugin specific component, that can be added inside 'Package/$(PKG_NAME)/install' definition.
|
||||
|
||||
After adding the makefile, user need to specify the list of plugins in below config option, so that sulu-builder selects them and build them along with it.
|
||||
```bash
|
||||
CONFIG_SULU_EXTRA_PACKAGES="sulu-plugin1 sulu-plugin2 sulu-theme1"
|
||||
```
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
config global 'global'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
. /lib/functions.sh
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
validate_sulu_global_section()
|
||||
{
|
||||
uci_validate_section sulu global global \
|
||||
'enabled:bool:1' \
|
||||
'enable_system_credentials:bool:1' \
|
||||
'role_based_access:bool:0'
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled enable_system_credentials role_based_access
|
||||
|
||||
config_load sulu
|
||||
procd_open_instance sulu
|
||||
|
||||
validate_sulu_global_section || return 0;
|
||||
# append sulu connection injection
|
||||
if [ "${enabled}" -eq "0" ]; then
|
||||
procd_close_instance
|
||||
return 0
|
||||
fi
|
||||
|
||||
update_nginx_template
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "sulu" "nginx"
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
||||
|
||||
location /robots.txt {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /sitemap.xml {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
||||
proxy_pass http://websocket;
|
||||
}
|
||||
|
||||
location / {
|
||||
autoindex on;
|
||||
expires -1;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range';
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "admin",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_ALL"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_DEL"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.IP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "undefined-1"
|
||||
},
|
||||
{
|
||||
"name": "undefined-2"
|
||||
},
|
||||
{
|
||||
"name": "undefined-3"
|
||||
},
|
||||
{
|
||||
"name": "undefined-4"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,388 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
_RESTART_SERVICES="0"
|
||||
|
||||
mkdir -p /tmp/sulu/
|
||||
|
||||
function slog()
|
||||
{
|
||||
echo "$*" |logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
function _get_agent_id()
|
||||
{
|
||||
local oui serial endpointid
|
||||
|
||||
endpointid="$(uci_get obuspa localagent EndpointID)"
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "${oui}-${serial//+/%2B}"
|
||||
else
|
||||
endpointid="$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_endpoint_id()
|
||||
{
|
||||
local oui serial endpointid
|
||||
|
||||
endpointid="$(uci_get obuspa localagent EndpointID)"
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "os::${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_sulu_users()
|
||||
{
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get nginx._sulu_s.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_usp_upstream_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get mosquitto.sulu.port)"
|
||||
echo "${port:-9009}"
|
||||
}
|
||||
|
||||
function _get_sulu_acl_file()
|
||||
{
|
||||
local file
|
||||
|
||||
file="$(uci -q get mosquitto.sulu.acl_file)"
|
||||
echo "${file}"
|
||||
}
|
||||
|
||||
function _get_sulu_tls_port()
|
||||
{
|
||||
local port listen
|
||||
|
||||
listen="$(uci -q get nginx._sulu_s.listen)"
|
||||
port="$(echo $listen|grep -Eo '[0-9]+'|head -n 1)"
|
||||
|
||||
echo "${port:-8443}"
|
||||
}
|
||||
|
||||
function update_nginx_template()
|
||||
{
|
||||
local port
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
port="$(_get_usp_upstream_port)"
|
||||
if ! grep -q "upstream websocket { server 127.0.0.1:${port}; }" ${UCI_TEMPLATE}; then
|
||||
sed -i "s/upstream websocket { server 127.0.0.1:[0-9]\+; }/upstream websocket { server 127.0.0.1:${var}; }/" ${UCI_TEMPLATE}
|
||||
log "Restarting nginx"
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function generate_sulu_conn_config()
|
||||
{
|
||||
local rbac users SCONFIG
|
||||
|
||||
rbac="${1}"
|
||||
users="$(_get_sulu_users)"
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
|
||||
json_init;
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
json_add_string 'currentConnection' 'rbac';
|
||||
else
|
||||
json_add_string 'currentConnection' 'main';
|
||||
fi
|
||||
json_add_object 'connections';
|
||||
json_add_object 'rbac';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
|
||||
json_add_object 'overrides';
|
||||
for f in ${users}; do
|
||||
json_add_object "${f}";
|
||||
json_add_string 'fromId' "self::sulu-${f}";
|
||||
json_add_string 'publishEndpoint' "/usp/$(_get_agent_id)/${f}/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/$(_get_agent_id)/${f}/controller";
|
||||
json_close_object;
|
||||
done
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
# add the default connection
|
||||
json_add_object 'main';
|
||||
json_add_string 'fromId' 'proto::interop-usp-controller';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_string 'publishEndpoint' "/usp/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/controller";
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
json_dump > ${SCONFIG}
|
||||
}
|
||||
|
||||
function set_sulu_connection_mode()
|
||||
{
|
||||
local rbac profile config SCONFIG
|
||||
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
rbac="${1}"
|
||||
|
||||
profile="$(jq '.currentConnection' ${SCONFIG})"
|
||||
if [ "$rbac" -eq "1" -a "${profile}" == "\"main\"" ]; then
|
||||
config="$(jq '.currentConnection = "rbac"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
elif [ "$rbac" -eq "0" -a "${profile}" == "\"rbac\"" ]; then
|
||||
config="$(jq '.currentConnection = "main"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
fi
|
||||
}
|
||||
|
||||
function update_sulu_connection_port()
|
||||
{
|
||||
local port ws_port SCONF
|
||||
|
||||
SCONF="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
ws_port="$(_get_sulu_tls_port)"
|
||||
|
||||
port="$(jq '.connections.rbac.port' ${SCONF})"
|
||||
if [ "${port}" -ne "${ws_port}" ]; then
|
||||
jq ".connections.main.port = ${ws_port} | .connections.rbac.port = ${ws_port}" ${SCONF} > /tmp/sulu/ss_port.json
|
||||
mv /tmp/sulu/ss_port.json ${SCONF}
|
||||
fi
|
||||
}
|
||||
|
||||
function _update_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
if ! uci_get obuspa localmqtt >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt localmqtt
|
||||
uci_set obuspa localmqtt BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa localmqtt BrokerPort "1883"
|
||||
uci_set obuspa localmqtt TransportProtocol "TCP/IP"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if ! uci_get obuspa agent_mtp >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp agent_mtp
|
||||
uci_set obuspa agent_mtp Protocol "MQTT"
|
||||
uci_set obuspa agent_mtp ResponseTopicConfigured "/usp/endpoint"
|
||||
uci_set obuspa agent_mtp mqtt "localmqtt"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if ! uci_get obuspa localcontroller >/dev/null 2>&1; then
|
||||
uci_add obuspa controller localcontroller
|
||||
uci_set obuspa localcontroller EndpointID "proto::interop-usp-controller"
|
||||
uci_set obuspa localcontroller Protocol "MQTT"
|
||||
uci_set obuspa localcontroller Topic "/usp/controller"
|
||||
uci_set obuspa localcontroller mqtt "localmqtt"
|
||||
uci_set obuspa localcontroller assigned_role_name "full_access"
|
||||
restart=1
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _remove_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
if [ "$(uci_get obuspa localmqtt)" == "mqtt" ]; then
|
||||
uci_remove obuspa localmqtt
|
||||
restart=1
|
||||
fi
|
||||
if [ "$(uci_get obuspa agent_mtp)" == "mtp" ]; then
|
||||
uci_remove obuspa agent_mtp
|
||||
restart=1
|
||||
fi
|
||||
if [ "$(uci_get obuspa localcontroller)" == "controller" ]; then
|
||||
uci_remove obuspa localcontroller
|
||||
restart=1
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _update_obuspa_config_rbac() {
|
||||
local agent users restart
|
||||
|
||||
agent="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
restart=0
|
||||
|
||||
for f in ${users}; do
|
||||
local sec
|
||||
|
||||
# Add mqtt
|
||||
sec="mqtt_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt ${sec}
|
||||
uci_set obuspa ${sec} BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa ${sec} BrokerPort "1883"
|
||||
uci_set obuspa ${sec} TransportProtocol "TCP/IP"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
# Add mtp
|
||||
sec="mtp_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp ${sec}
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} ResponseTopicConfigured "/usp/${agent}/${f}/endpoint"
|
||||
uci_set obuspa ${sec} mqtt "mqtt_sulu_$f"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
# Add controller
|
||||
sec="controller_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa controller ${sec}
|
||||
uci_set obuspa ${sec} EndpointID "self::sulu-${f}"
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} Topic "/usp/${agent}/${f}/controller"
|
||||
uci_set obuspa ${sec} mqtt "mqtt_sulu_$f"
|
||||
uci_set obuspa ${sec} assigned_role_name "$f"
|
||||
restart=1
|
||||
fi
|
||||
done
|
||||
if [ -f "/etc/sulu/roles.json" ]; then
|
||||
uci_set obuspa global role_file "/etc/sulu/roles.json"
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _remove_sulu_sec()
|
||||
{
|
||||
local sec
|
||||
|
||||
if [[ "${1}" == *"_sulu_"* ]]; then
|
||||
uci_remove obuspa ${1}
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function _remove_obuspa_config_rbac()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
config_foreach _remove_sulu_sec mqtt
|
||||
restart="$(( restart + $? ))"
|
||||
config_foreach _remove_sulu_sec mtp
|
||||
restart="$(( restart + $? ))"
|
||||
config_foreach _remove_sulu_sec controller
|
||||
restart="$(( restart + $? ))"
|
||||
uci_set obuspa global role_file ""
|
||||
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _create_acl() {
|
||||
local agentid rbac users restart
|
||||
local ACL_FILE
|
||||
|
||||
rbac="${1:-0}"
|
||||
restart="0"
|
||||
|
||||
ACL_FILE="$(_get_sulu_acl_file)"
|
||||
if [ -z "${ACL_FILE}" -o "${rbac}" -eq "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "${ACL_FILE}" ]; then
|
||||
rm -f "${ACL_FILE}"
|
||||
fi
|
||||
touch "${ACL_FILE}"
|
||||
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
users="$(_get_sulu_users)"
|
||||
agentid="$(_get_agent_id)"
|
||||
for f in ${users}; do
|
||||
if ! grep -q "user $f" ${ACL_FILE}; then
|
||||
echo "user ${f}" >> ${ACL_FILE}
|
||||
echo "topic read /usp/${agentid}/${f}/controller/reply-to/#" >> ${ACL_FILE}
|
||||
echo "topic write /usp/${agentid}/${f}/endpoint/#" >> ${ACL_FILE}
|
||||
echo "topic read /usp/${agentid}/${f}/controller/#" >> ${ACL_FILE}
|
||||
echo "" >> ${ACL_FILE}
|
||||
restart="1"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${restart}" -gt "0" ]; then
|
||||
slog "Restarting mosquitto..."
|
||||
ubus call uci commit '{"config":"mosquitto"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function update_obuspa_config()
|
||||
{
|
||||
local rbac restart
|
||||
|
||||
rbac="${1}"
|
||||
restart=0
|
||||
|
||||
uci_load obuspa
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
_remove_obuspa_config
|
||||
restart="$(( restart + $? ))"
|
||||
_update_obuspa_config_rbac
|
||||
restart="$(( restart + $? ))"
|
||||
else
|
||||
_remove_obuspa_config_rbac
|
||||
restart="$(( restart + $? ))"
|
||||
_update_obuspa_config
|
||||
restart="$(( restart + $? ))"
|
||||
fi
|
||||
uci_commit obuspa
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -gt "0" ]; then
|
||||
slog "Restarting obuspa..."
|
||||
ubus call uci commit '{"config":"obuspa"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_sulu()
|
||||
{
|
||||
local sys_cred rbac restart
|
||||
|
||||
sys_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart="${3:-0}"
|
||||
|
||||
if [ -z "${sys_cred}" -o -z "${rbac}" ]; then
|
||||
slog "Invalid inputs"
|
||||
return 0
|
||||
fi
|
||||
|
||||
_RESTART_SERVICES="${restart}"
|
||||
|
||||
set_sulu_connection_mode "${rbac}"
|
||||
update_obuspa_config "${rbac}"
|
||||
_create_acl "${rbac}"
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
update_nginx_uci_template()
|
||||
{
|
||||
if ! grep -q "upstream websocket" ${UCI_TEMPLATE}; then
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:9009; }' ${UCI_TEMPLATE}
|
||||
fi
|
||||
}
|
||||
|
||||
update_nginx_uci_template
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ ! -f "/etc/config/mosquitto" ]; then
|
||||
echo "Local mosquitto broker not available"
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_obuspa_config()
|
||||
{
|
||||
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener obuspa
|
||||
uci_set mosquitto obuspa enabled 1
|
||||
uci_set mosquitto obuspa port '1883'
|
||||
uci_set mosquitto obuspa no_remote_access '1'
|
||||
uci_set mosquitto obuspa allow_anonymous '1'
|
||||
fi
|
||||
}
|
||||
|
||||
add_sulu_config()
|
||||
{
|
||||
if ! uci_get mosquitto sulu >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener sulu
|
||||
uci_set mosquitto sulu enabled 1
|
||||
uci_set mosquitto sulu port '9009'
|
||||
uci_set mosquitto sulu no_remote_access '1'
|
||||
uci_set mosquitto sulu protocol 'websockets'
|
||||
uci_set mosquitto sulu require_certificates '0'
|
||||
uci_set mosquitto sulu auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
|
||||
uci_set mosquitto sulu acl_file '/tmp/sulu/mqtt.acl'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_obuspa_config
|
||||
add_sulu_config
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
config_load sulu
|
||||
config_get enable_system_credentials global enable_system_credentials 1
|
||||
config_get role_based_access global role_based_access 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
25
sulu/sulu-base/Makefile
Normal file
25
sulu/sulu-base/Makefile
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=4829fa5f5c9021ce08c69efb5761264aaf230963
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
endef
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
124
sulu/sulu-builder/Makefile
Normal file
124
sulu/sulu-builder/Makefile
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
#
|
||||
# Copyright (C) 2021-2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=2.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=5afc6429756dd9e57b944e3744b3d184098ef95e
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
SULU_PLUGINS:=$(filter-out sulu-builder,$(notdir $(wildcard ../*)))
|
||||
SULU_EXTRA:=$(subst $\",,$(CONFIG_SULU_EXTRA_PACKAGES))
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sulu/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=SULU
|
||||
TITLE:=SULU-CE
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu
|
||||
$(Package/sulu/default)
|
||||
CONFLICTS:=sulu-builder
|
||||
TITLE += (Binaries)
|
||||
VARIANT:=binary
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
define Package/sulu-builder
|
||||
$(Package/sulu/default)
|
||||
TITLE += (Builder)
|
||||
VARIANT:=builder
|
||||
DEPENDS+=+sulu-base $(foreach plugin,$(SULU_PLUGINS), +PACKAGE_$(plugin):$(plugin)) $(foreach plugin,$(SULU_EXTRA), +PACKAGE_$(plugin):$(plugin))
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
SULU-CE ReactJS based Web UI works on USP with websocket.
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/description
|
||||
SULU-CE ReactJS based Web UI builder.
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/config
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_sulu-builder
|
||||
|
||||
config SULU_EXTRA_PACKAGES
|
||||
string "Space separated list of sulu packages"
|
||||
help
|
||||
You can specify the list of non core sulu package,
|
||||
so that sulu-builder include them before building the core.
|
||||
endmenu
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),builder)
|
||||
define Build/Compile
|
||||
VERSION="v${PKG_VERSION}" CORE_DIR="../core/sulu-*" PLUGINS_PATH="../plugins" $(MAKE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
else
|
||||
define Build/Compile
|
||||
# Pass
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Clean
|
||||
$(RM) -r $(BUILD_DIR)/sulu-$(PKG_VERSION)
|
||||
endef
|
||||
|
||||
define Package/sulu/install/Default
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
define Package/sulu/install
|
||||
$(Package/sulu/install/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu
|
||||
ifneq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(RM) $(1)/sulu/config/widgets/lcm-store.json
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/install
|
||||
$(Package/sulu/install/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu-builder))
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
|
|
@ -20,6 +20,7 @@ add_sulu_nginx_uci()
|
|||
uci_set nginx _sulu_s ssl_session_cache 'shared:SSL:32k'
|
||||
uci_set nginx _sulu_s ssl_session_timeout '64m'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
uci_set nginx _sulu_s error_log '/dev/null'
|
||||
fi
|
||||
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
47
sulu/sulu-builder/sulu.mk
Normal file
47
sulu/sulu-builder/sulu.mk
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
MK_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
SULU_NAME?=$(notdir $(CURDIR))
|
||||
SULU_URL?=https://dev.iopsys.eu/websdk
|
||||
SULU_MAINTAINER?=IOPSYS SuLu team
|
||||
|
||||
SULU_MOD?=plugins
|
||||
|
||||
PKG_NAME?=$(SULU_NAME)
|
||||
PKG_RELEASE?=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
SULU_VERSION=$(shell grep -oP '(?<=^PKG_VERSION:=).*' ${MK_DIR}/Makefile)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(SULU_VERSION)/$(SULU_MOD)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=SULU
|
||||
TITLE:=$(if $(SULU_TITLE),$(SULU_TITLE),Sulu plugin or module $(SULU_NAME))
|
||||
EXTRA_DEPENDS:=sulu-builder
|
||||
URL:=$(SULU_URL)/$(SULU_NAME)
|
||||
MAINTAINER:=$(SULU_MAINTAINER)
|
||||
endef
|
||||
|
||||
ifneq ($(SULU_DESCRIPTION),)
|
||||
define Package/$(PKG_NAME)/description
|
||||
$(strip $(SULU_DESCRIPTION))
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
# Pass
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
23
sulu/sulu-lcm/Makefile
Normal file
23
sulu/sulu-lcm/Makefile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-lcm
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-lcm.git
|
||||
PKG_SOURCE_VERSION:=b3f6028fd168e58b93ae56f616e96712849c656a
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
endef
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
16
sulu/sulu-multi-ap/Makefile
Normal file
16
sulu/sulu-multi-ap/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-multi-ap
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-multi-ap.git
|
||||
PKG_SOURCE_VERSION:=1eca5af280789cef3feeeb4d296ed01f87b15bb0
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
16
sulu/sulu-parental-control/Makefile
Normal file
16
sulu/sulu-parental-control/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-parental-control
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-parental-control.git
|
||||
PKG_SOURCE_VERSION:=65491b1d1939f9946261d05735f50b8aee60f262
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
17
sulu/sulu-theme-iopsys/Makefile
Normal file
17
sulu/sulu-theme-iopsys/Makefile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-theme-iopsys
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-theme-iopsys.git
|
||||
PKG_SOURCE_VERSION:=e80fea80cdf8d49db0ae70b5c26a5dab49b8a20d
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
Loading…
Add table
Reference in a new issue