[LEDE-DEV] Stock config files as templates
Michael Heimpold
mhei at heimpold.de
Wed Jul 26 14:55:20 PDT 2017
Hi Philip,
Am Dienstag, 25. Juli 2017, 10:29:06 CEST schrieb Philip Prindeville:
> 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?
I started working on this topic some weeks ago, too, but
did not yet completed it - if you are interested, I've pushed it here:
https://github.com/mhei/packages/tree/ntpd-uci
I used the 'include' statement to have a mostly static /etc/ntp.conf
and generate a dynamic file for inclusion in /tmp...
HTH,
Michael
More information about the Lede-dev
mailing list