Skip to content

Commit

Permalink
Merge pull request #7056 from TDT-AG/pr/20240411-ucitrack
Browse files Browse the repository at this point in the history
luci-base: conversion of ucitrack handling from uci to json
  • Loading branch information
feckert authored Apr 16, 2024
2 parents b5b14a4 + 4cffc9f commit d5c413d
Show file tree
Hide file tree
Showing 42 changed files with 145 additions and 259 deletions.
10 changes: 0 additions & 10 deletions applications/luci-app-ahcp/root/etc/uci-defaults/40_luci-ahcp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "ahcpd",
"init": "ahcpd"
}
9 changes: 0 additions & 9 deletions applications/luci-app-ddns/root/etc/uci-defaults/40_luci-ddns

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "dynapoint",
"init": "dynapoint"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"config": "firewall",
"init": "firewall",
"affects": [
"luci-splash",
"qos",
"miniupnpd"
]
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "irqbalance",
"init": "irqbalance"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "libreswan",
"init": "ipsec"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/sh

# remove existing mwan ucitrack entry is now done with procd
uci -q batch <<-EOF >/dev/null
del ucitrack.@mwan3[-1]
commit ucitrack
EOF

uci -q get mwan3.globals >/dev/null || {
uci -q add mwan3 globals >/dev/null
uci -q rename mwan3.@globals[-1]="globals" >/dev/null
Expand Down
13 changes: 0 additions & 13 deletions applications/luci-app-olsr/root/etc/uci-defaults/40_luci-olsr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "olsrd",
"init": "olsrd"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "olsrd6",
"init": "olsrd6"
}
10 changes: 0 additions & 10 deletions applications/luci-app-p910nd/root/etc/uci-defaults/40_luci-p910nd

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "p910nd",
"init": "p910nd"
}
10 changes: 0 additions & 10 deletions applications/luci-app-polipo/root/etc/uci-defaults/40_luci-polipo

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "polipo",
"init": "polipo"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "qos",
"init": "qos"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "samba",
"init": "samba"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "luci_splash",
"init": "luci_splash"
}
12 changes: 0 additions & 12 deletions applications/luci-app-sqm/root/etc/uci-defaults/50-luci-sqm

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"config": "sqm",
"init": "sqm",
"affects": [
"sqm"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "tinyproxy",
"init": "tinyproxy"
}
10 changes: 0 additions & 10 deletions applications/luci-app-upnp/root/etc/uci-defaults/40_luci-miniupnp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "upnpd",
"init": "miniupnpd"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"config": "watchcat",
"init": "watchcat"
}
1 change: 0 additions & 1 deletion modules/luci-base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ include $(INCLUDE_DIR)/host-build.mk
define Package/luci-base/conffiles
/etc/luci-uploads
/etc/config/luci
/etc/config/ucitrack
endef

define Package/luci-base/postinst
Expand Down
56 changes: 0 additions & 56 deletions modules/luci-base/root/etc/config/ucitrack

This file was deleted.

41 changes: 32 additions & 9 deletions modules/luci-base/root/etc/init.d/ucitrack
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
START=80
USE_PROCD=1

. "$IPKG_INSTROOT/usr/share/libubox/jshn.sh"

register_init() {
local config="$1"
local init="$2"
Expand All @@ -15,13 +17,25 @@ register_init() {
}

register_trigger() {
local sid="$1"
local uci="$1"
local file="$2"

local config init exec affects affected
local prev

config_get config "$sid" TYPE
config_get init "$sid" init
config_get exec "$sid" exec
config_get affects "$sid" affects
json_set_namespace config prev
json_init
json_load_file "${file}" >/dev/null 2>&1
json_get_var config 'config'
[ "$config" = "$uci" ] || {
json_set_namespace "$prev"
return
}
json_get_var init 'init'
json_get_var exec 'exec'
json_get_values affects 'affects'
json_cleanup
json_set_namespace "$prev"

if [ -n "$init" ]; then
register_init "$config" "/etc/init.d/$init" "reload"
Expand All @@ -48,10 +62,19 @@ register_trigger() {
done
}

service_triggers() {
config_foreach register_trigger
check_trigger() {
local config="$1"

local file

for file in /usr/share/ucitrack/*.json; do
[ -f "$file" ] || continue
register_trigger "$config" "$file"
done
}

start_service() {
config_load ucitrack
service_triggers() {
for config in /etc/config/*; do
check_trigger "${config##*/}"
done
}
Loading

0 comments on commit d5c413d

Please sign in to comment.