I would recommend two options and break this into two steps or concepts. (1) A new option removes default servers. This option is independent of option 2. For implementation, an inline awk script might have more robust syntax then sed. (2) Current list server option adds servers to the list. Easy and purely additive.
- Eric > -------- Original message -------- > From: Philip Prindeville <philipp_s...@redfish-solutions.com> > Date: 7/25/17 12:29 (GMT-05:00) > To: LEDE Development List <lede-dev@lists.infradead.org> > Subject: [LEDE-DEV] Stock config files as templates > > 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 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev