Files
ssmithxandClaude Opus 5.5 a25e910b59 procd-compat: UCI changes reload services; ubus system object
A ucode daemon publishes procd's ubus `service' and `system' objects.
config.change (from reload_config after `uci commit', or rpcd) runs
`herd reload' on the Shepherd services registered for that config;
services register by extending procd-compat-service-type (firewall,
dhcp -> odhcpd, network/wireless -> netifd, which gains a reload
action).  `system board/info/reboot' answer in procd's format, for
LuCI.  `service get_data' answers too: fw4 waits on it once the object
exists, so reloads run asynchronously (PITFALLS #40).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:37:38 -04:00

19 lines
698 B
Bash
Executable File

#!/bin/sh
# reload_config: after `uci commit', tell procd(-compat) which configs
# changed since the last run, so it reloads the services that use them.
# As OpenWrt's procd/files/reload_config: compare `uci show' digests.
rm -rf /var/run/config.check
mkdir -p /var/run/config.check
for config in /etc/config/*; do
file=${config##*/}
uci show "$file" > /var/run/config.check/$file
done
MD5FILE=/var/run/config.md5
[ -f $MD5FILE ] && {
for c in $(md5sum -c $MD5FILE 2>/dev/null | grep FAILED | cut -d: -f1); do
ubus call service event "{ \"type\": \"config.change\", \"data\": { \"package\": \"$(basename $c)\" }}"
done
}
md5sum /var/run/config.check/* > $MD5FILE
rm -rf /var/run/config.check