As sysupgrade doesn't run on x86 and likely won't for a while (if ever) I've 
had to work around this by taking the contents of files in /overlay/ and 
diffing them against the same files rooted in /rom/... then hand-editing these 
into batches of new /etc/uci-default scripts to reapply those changes every 
time I install and boot a new image onto a semi-production box for testing and 
dogfooding.

The problem is that most of the files 'diff' at or near 100% for a variety of 
reasons:

(1) lines get reordered;
(2) comments get stripped;
(3) UCI canonicalizes output;

For instance:

# diff -u /rom/etc/config/luci /overlay/etc/config/
--- /rom/etc/config/luci        2009-09-10 02:05:56.000000000 -0600
+++ /overlay/etc/config//luci   2011-09-08 09:44:09.000000000 -0600
@@ -1,24 +1,28 @@
-config core main
-       option lang auto
-       option mediaurlbase /luci-static/openwrt.org
-       option resourcebase /luci-static/resources
-       
-config extern flash_keep
-       option uci              "/etc/config/"
-       option dropbear "/etc/dropbear/"
-       option openvpn  "/etc/openvpn/"
-       option passwd   "/etc/passwd"
-       option opkg             "/etc/opkg.conf"
-       option firewall "/etc/firewall.user"
-       option uploads  "/lib/uci/upload/"
-       
-config internal languages
-       
-config internal sauth
-       option sessionpath "/tmp/luci-sessions"
-       option sessiontime 3600
-       
-config internal ccache
-       option enable 1
-               
-config internal themes
+
+config 'core' 'main'
+       option 'lang' 'auto'
+       option 'mediaurlbase' '/luci-static/openwrt.org'
+       option 'resourcebase' '/luci-static/resources'
+
+config 'extern' 'flash_keep'
+       option 'uci' '/etc/config/'
+       option 'dropbear' '/etc/dropbear/'
+       option 'openvpn' '/etc/openvpn/'
+       option 'passwd' '/etc/passwd'
+       option 'opkg' '/etc/opkg.conf'
+       option 'firewall' '/etc/firewall.user'
+       option 'uploads' '/lib/uci/upload/'
+
+config 'internal' 'languages'
+       option 'en' 'English'
+
+config 'internal' 'sauth'
+       option 'sessionpath' '/tmp/luci-sessions'
+       option 'sessiontime' '3600'
+
+config 'internal' 'ccache'
+       option 'enable' '1'
+
+config 'internal' 'themes'
+       option 'OpenWrt' '/luci-static/openwrt.org'
+

As you can see, literally every line shows up as having changed.

The first and second issues are only minor...  But the canonicalization is the 
most problematic, taking:

config internal languages

and converting this to:

config 'internal' 'languages'

It seems that it would be trivial to only add quotes when they are required. 
For instance, tokens that are only letters, underscores, and digits (i.e. 
[a-zA-Z_0-9]*) don't need quoting.

Also, the line:

        option sessionpath "/tmp/luci-sessions"

gets rewritten as:

        option 'sessionpath' '/tmp/luci-sessions'

Can we go with a single quoting style and stick with that and eradicate the 
other?

Can we also order the source files' lines in the same order that they would be 
output so there's no reordering?

Thanks,

-Philip
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to