procd: add a small script that handles config reloads until configd is ready
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37248
This commit is contained in:
		@@ -60,6 +60,10 @@ start() {
 | 
				
			|||||||
	rm -f /tmp/wireless.tmp
 | 
						rm -f /tmp/wireless.tmp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apply_uci_config
 | 
						apply_uci_config
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						# temporary hack until configd exists
 | 
				
			||||||
 | 
						/sbin/reload_config
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	config_load system
 | 
						config_load system
 | 
				
			||||||
	config_foreach system_config system
 | 
						config_foreach system_config system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,6 +80,10 @@ start_service() {
 | 
				
			|||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					service_triggers() {
 | 
				
			||||||
 | 
						return 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stop_service() {
 | 
					stop_service() {
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,6 +32,7 @@ define Package/procd/install
 | 
				
			|||||||
	$(INSTALL_DIR) $(1)/sbin $(1)/lib/functions $(1)/etc/init.d
 | 
						$(INSTALL_DIR) $(1)/sbin $(1)/lib/functions $(1)/etc/init.d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/{procd,askfirst,udevtrigger,logread} $(1)/sbin/
 | 
						$(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_BIN) ./files/log.init $(1)/etc/init.d/log
 | 
				
			||||||
	$(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
 | 
						$(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
 | 
				
			||||||
	$(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
 | 
						$(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,6 +67,9 @@ _procd_open_service() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
_procd_close_service() {
 | 
					_procd_close_service() {
 | 
				
			||||||
	json_close_object
 | 
						json_close_object
 | 
				
			||||||
 | 
						_procd_open_trigger
 | 
				
			||||||
 | 
						service_triggers
 | 
				
			||||||
 | 
						_procd_close_trigger
 | 
				
			||||||
	_procd_ubus_call set
 | 
						_procd_ubus_call set
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								package/system/procd/files/reload_config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								package/system/procd/files/reload_config
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user