[LEDE-DEV] Stock config files as templates
Philip Prindeville
philipp_subx at redfish-solutions.com
Tue Jul 25 09:29:06 PDT 2017
I’m working on Issue #4588 (ntpd needs UCI parsing comparable to sysntpd) and I had a question…
ntpd ships with the canned /etc/ntp.conf from the distro, but if we specify:
config timeserver ntp
list server ‘ntp.redfish-solutions.com’
then the /etc/ntp.conf file needs to be rewritten as:
driftfile /var/lib/ntp/ntp.drift
server 0.openwrt.pool.ntp.org iburst
server 1.openwrt.pool.ntp.org iburst
server 2.openwrt.pool.ntp.org iburst
server 3.openwrt.pool.ntp.org iburst
...
to:
drift file /var/lib/ntp/ntp.drift
server ntp.redfish-solutions.com iburst
...
instead. Are there any good guidelines (or examples) on how to mangle config files in-place?
I’m guessing I’d need a sed script with a loop to gather all of the ‘server’ lines and replace them with one.
Or am I missing something obvious?
Thanks,
-Philip
More information about the Lede-dev
mailing list