icwmp: align with opconf

This commit is contained in:
Vivek Kumar Dutta 2025-11-04 21:27:46 +05:30
parent c153911acf
commit 99fe2c2b2a
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C
4 changed files with 28 additions and 8 deletions

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.10.6
PKG_VERSION:=9.10.7
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
PKG_SOURCE_VERSION:=ca5227149c47c4dae96bc2613a038aecc7944819
PKG_SOURCE_VERSION:=c73d9fa100934bf9d2e0414f75658173486b98bf
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@ -84,6 +84,7 @@ define Package/icwmp/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
$(INSTALL_BIN) ./files/etc/uci-defaults/50-cwmp-align-keep-config $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/

View file

@ -42,7 +42,9 @@ config cpe 'cpe'
option periodic_notify_interval '10'
option incoming_rule 'Port_Only'
option active_notif_throttle '0'
option fw_upgrade_keep_settings '1'
option KeepConfig '1'
option KeepOpConf '1'
option ConfigScope 'UserOnly'
option clock_sync_timeout '128'
option disable_datatype_check '0'
#list allowed_cr_ip '10.5.1.0/24'

View file

@ -97,7 +97,9 @@ validate_cpe_section()
'periodic_notify_enable:bool' \
'enable:bool:1' \
'periodic_notify_interval:uinteger' \
'fw_upgrade_keep_settings:bool'
'KeepConfig:bool:1' \
'KeepOpConf:bool:1' \
'ConfigScope:string:UserOnly'
}
validate_defaults() {
@ -168,13 +170,21 @@ start_service() {
stop_service()
{
local switch_bank
local switch_bank KeepConfig KeepOpConf ConfigScope
copy_cwmp_varstate_files_to_etc
switch_bank=$(uci -q -c /var/state/ get icwmp.cpe.switch_bank)
if [ -n "$switch_bank" ] && [ "$switch_bank" = "1" ]; then
[ -x /etc/sysmngr/fwbank ] && /etc/sysmngr/fwbank call copy_config
if [ "$switch_bank" = "1" ] && [ -x /etc/sysmngr/fwbank ]; then
KeepConfig="$(uci -q get cwmp.cpe.KeepConfig)"
KeepOpConf="$(uci -q get cwmp.cpe.KeepOpConf)"
ConfigScope="$(uci -q get cwmp.cpe.ConfigScope)"
json_init
[ -n "${KeepConfig}" ] && json_add_boolean "KeepConfig" "${KeepConfig}"
[ -n "${KeepOpConf}" ] && json_add_boolean "KeepOpConf" "${KeepOpConf}"
[ -n "${ConfigScope}" ] && json_add_string "ConfigScope" "${ConfigScope}"
json_dump| /etc/sysmngr/fwbank call copy_config
fi
}

View file

@ -0,0 +1,7 @@
#!/bin/sh
keep_settings="$(uci -q get cwmp.cpe.fw_upgrade_keep_settings)"
if [ -n "${keep_settings}" ]; then
uci -q delete cwmp.cpe.fw_upgrade_keep_settings
uci -q set cwmp.cpe.KeepConfig="${keep_settings}"
fi