procd: add a small script that handles config reloads until configd is ready
authorJohn Crispin <john@openwrt.org>
Thu, 11 Jul 2013 17:00:54 +0000 (17:00 +0000)
committerJohn Crispin <john@openwrt.org>
Thu, 11 Jul 2013 17:00:54 +0000 (17:00 +0000)
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 37248

package/base-files/files/etc/init.d/boot
package/base-files/files/etc/rc.common
package/system/procd/Makefile
package/system/procd/files/procd.sh
package/system/procd/files/reload_config [new file with mode: 0644]

index 078adb8ecc3820a089203e73e084874472a90b8c..aad59e25dadd376cd25b17743936867b0b1ae0ab 100755 (executable)
@@ -60,6 +60,10 @@ start() {
        rm -f /tmp/wireless.tmp
 
        apply_uci_config
+       
+       # temporary hack until configd exists
+       /sbin/reload_config
+       
        config_load system
        config_foreach system_config system
 
index aeec90c37ca5e22e64d579263a6beb9677808823..22111895db2e3235db2d790a1943ca0e25a42eeb 100755 (executable)
@@ -80,6 +80,10 @@ start_service() {
        return 0
 }
 
+service_triggers() {
+       return 0
+}
+
 stop_service() {
        return 0
 }
index 27879e8443d31b0ef1214947059c3c0195662783..b91af9814618f2754d83e5063dcebe4ef5f8eb90 100644 (file)
@@ -32,6 +32,7 @@ define Package/procd/install
        $(INSTALL_DIR) $(1)/sbin $(1)/lib/functions $(1)/etc/init.d
 
        $(CP) $(PKG_INSTALL_DIR)/usr/sbin/{procd,askfirst,udevtrigger,logread} $(1)/sbin/
+       $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
        $(INSTALL_BIN) ./files/log.init $(1)/etc/init.d/log
        $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
        $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
index b706b1e97d3d57176f489597409690aa04f0a3c6..096eb2de32a9d274a6bce59e5c97ffbea2e593a8 100644 (file)
@@ -67,6 +67,9 @@ _procd_open_service() {
 
 _procd_close_service() {
        json_close_object
+       _procd_open_trigger
+       service_triggers
+       _procd_close_trigger
        _procd_ubus_call set
 }
 
diff --git a/package/system/procd/files/reload_config b/package/system/procd/files/reload_config
new file mode 100644 (file)
index 0000000..ef8ab87
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+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 /etc/config/* > $MD5FILE