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

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Fri Sep 25 15:47:51 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>
---
v2 - original patch generated from incorrect branch and had all sorts
of rubbish in it.

 package/base-files/files/sbin/sysupgrade | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index ef83c4b..a3400e8 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -142,6 +142,15 @@ do_save_conffiles() {
 		return 0
 	}
 	run_hooks "$CONFFILES" $sysupgrade_init_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"
 
 	v "Saving config files..."
-- 
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