[OpenWrt-Devel] [PATCH] base-files: sbin/sysupgrade preserve dnsmasq.time

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Thu Sep 24 08:01:02 EDT 2015


dnsmasq uses /etc/dnsmasq.time as record of the last known good
system time to aid its validation of dnssec timestamps.  dnsmasq
updates the timestamp on process start/stop once it considers the system
time as valid. The timestamp file should be preserved across system
upgrade but should not be included as part of normal configuration
backups to prevent restores corrupting the current timestamps.

Signed-off-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
---
 package/base-files/files/sbin/sysupgrade | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 4bc52ea..59f1fad 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -142,13 +142,12 @@ do_save_conffiles() {
 	}
 	run_hooks "$CONFFILES" $sysupgrade_init_conffiles
 
-#if upgrade with save files and dnsmasq running then stop dnsmasq (to update timestamp)
-#and add /etc/dnsmasq.time to archive
-
-#KevinDB: if its a procd service then: ubus call service list '{"name":"dnsmasq"}' | jsonfilter -e '@.*.instances.instance1.running'
-	if [ $(ubus call service list '{"name":"dnsmasq"}' | jsonfilter -e '@.*.instances.instance1.running') = "true" ]; then
-		/etc/init.d/dnsmasq restart
-		echo "/etc/dnsmasq.time" >>$CONFFILES
+	if [ -z $NEED_IMAGE ]; then
+		if [ $(ubus call service list '{"name":"dnsmasq"}' | jsonfilter -e '@.*.instances.instance1.running') = "true" ]; then
+			/etc/init.d/dnsmasq restart
+			sleep 1
+			echo "/etc/dnsmasq.time" >>$CONFFILES
+		fi
 	fi
 
 	ask_bool 0 "Edit config file list" && vi "$CONFFILES"
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list