dmcli: support 'user' profile

This commit is contained in:
Meng 2026-02-16 13:38:20 +01:00 committed by Vivek Kumar Dutta
parent 910803ca61
commit f8182a167c
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C
4 changed files with 36 additions and 5 deletions

View file

@ -11,12 +11,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dmcli
PKG_LICENSE:=PROPRIETARY GENEXIS
PKG_VERSION:=1.10.0
PKG_VERSION:=1.10.1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/gnx/dmcli.git
PKG_SOURCE_VERSION:=6144c106e9a48a23b527e79308ca210ff10ac574
PKG_SOURCE_VERSION:=003402b804e4a0c0d640637cbbb2ee7809004b5c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip

View file

@ -2,3 +2,8 @@ user operator
topic read /usp/operator/controller/reply-to
topic read /usp/operator/controller
topic write /usp/operator/endpoint
user user
topic read /usp/000F94-${SerialNumber}/user/controller/reply-to
topic read /usp/000F94-${SerialNumber}/user/controller
topic write /usp/000F94-${SerialNumber}/user/endpoint

View file

@ -1,19 +1,33 @@
{
"Settings": {
"USP": {
"ActiveConnectionProfile": "local",
"ActiveConnectionProfile": "operator",
"ConnectionProfile": [
{
"Name": "local",
"Name": "operator",
"Host": "127.0.0.1",
"Port": 9002,
"Username": "operator",
"Protocol": "ws",
"FromId": "oui:000F94:device-controller-operator",
"PublishEndpoint": "/usp/operator/endpoint",
"SubscribeEndpoint": "/usp/operator/controller"
"SubscribeEndpoint": "/usp/operator/controller",
"ToId": "os::000F94-${SerialNumber}"
},
{
"Name": "user",
"Host": "127.0.0.1",
"Port": 9002,
"Username": "user",
"Password": "${UserPassword}",
"Protocol": "ws",
"FromId": "self::sulu-user",
"PublishEndpoint": "/usp/000F94-${SerialNumber}/user/endpoint",
"SubscribeEndpoint": "/usp/000F94-${SerialNumber}/user/controller",
"ToId": "os::000F94-${SerialNumber}"
}
],
"Timeout": 30,
"Session": {
"AutoStart": false
},

View file

@ -35,6 +35,18 @@ uci -q set users.operator.enabled=1
uci -q set users.operator.shell='dmcli'
uci -q set users.operator.member_roles='operator'
# fix SerialNumber and UserPassword for 'user' acl and conf
serial_number="$(fw_printenv SerialNumber -n 2>/dev/null)"
if [ -n "${serial_number}" ]; then
sed -i "s/\${SerialNumber}/${serial_number}/g" /etc/dmcli/dmcli.acl
sed -i "s/\${SerialNumber}/${serial_number}/g" /etc/dmcli/dmcli.conf
fi
user_password="$(fw_printenv UserPassword -n 2>/dev/null)"
if [ -n "${user_password}" ]; then
sed -i "s/\${UserPassword}/${user_password}/g" /etc/dmcli/dmcli.conf
fi
if [ -f "/etc/config/mosquitto" ]; then
uci_add mosquitto listener dmcli_local
uci_set mosquitto dmcli_local enabled 1