From: Roy Marples Date: Tue, 12 Aug 2008 20:46:42 +0000 (+0000) Subject: ntp.conf could have more than just servers, but DHCP only knows about servers. Soluti... X-Git-Tag: v4.0.2~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=444ceeeb4c5e4712c09870800e2b1a55c33be07b;p=thirdparty%2Fdhcpcd.git ntp.conf could have more than just servers, but DHCP only knows about servers. Solution == use egrep to grab everything but servers and append to it :) --- diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index 2b3e40e4..6cc1b670 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -14,11 +14,10 @@ make_ntp_conf() { [ -z "${new_ntp_servers}" ] && return 0 local cf=/etc/ntp.conf."${interface}" x= - echo "# ${signature}" > "${cf}" - echo "restrict default noquery notrust nomodify" >> "${cf}" - echo "restrict 127.0.0.1" >> "${cf}" + + grep -v "\(^[ \t]*server[ \t]*\|${signature}\)" /etc/ntp.conf > "${cf}" + echo "# ${signature}" >> "${cf}" for x in ${new_ntp_servers}; do - echo "restrict ${x} nomodify notrap noquery" >> "${cf}" echo "server ${x}" >> "${cf}" done save_conf /etc/ntp.conf