diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2009-06-17 15:54:59 -0700 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2009-06-17 15:54:59 -0700 |
commit | 08d0d9ed2d8824a446bfe6a1ba660db854f1a8f5 (patch) | |
tree | 44ae06b1c3821a84e6aa0c4b26672240d07b47ff /scripts | |
parent | ebb0524cc5eb8732d12c1dfcac612fd567c15144 (diff) | |
download | vyatta-cfg-system-08d0d9ed2d8824a446bfe6a1ba660db854f1a8f5.tar.gz vyatta-cfg-system-08d0d9ed2d8824a446bfe6a1ba660db854f1a8f5.zip |
Bugfix 4592: Generate NTP config file from Vyatta configuration parameters.
This fix changes the way that the /etc/ntp.conf file is generated. Now
it is generated at boot time using a fixed section that contains
only parameters that users don't change, plus a section that is generated
from any "system ntp-servers" parameters that are configured. The fixed
section does not contain any "server" definitions, so all server definitions
come from the Vyatta config.
The Vyatta configuration template for this parameter and code
at other places in the system will now start the NTP server ONLY if
there is at least one NTP server configured. So the user can "turn off"
the NTP server by just deleting all NTP servers from the configuration.
The default "config.boot" file does contiain one built-in "system ntp-servers"
parameter, so a newly installed system will start the NTP server.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rl-system.init | 10 | ||||
-rwxr-xr-x | scripts/system/vyatta_update_resolv.pl | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/scripts/rl-system.init b/scripts/rl-system.init index 4c8c937f..e05e0564 100755 --- a/scripts/rl-system.init +++ b/scripts/rl-system.init @@ -154,12 +154,22 @@ set_ipv6_params () done } +setup_ntp_config_file () { + template_ntp_conf=/opt/vyatta/etc/ntp.conf + if [ -e $template_ntp_conf ]; then + cp -f $template_ntp_conf /etc/ntp.conf + else + log_failure_msg "NTP template config file doesn\'t exist" + fi +} + start () { udev_rescan create_ssh_host_keys || \ log_failure_msg "can't initialize ssh host keys" clear_or_override_config_files || \ log_failure_msg "can\'t reset config files" + setup_ntp_config_file add_new_serial_if || \ log_failure_msg "can\'t add serial interfaces" sysctl -q -p /opt/vyatta/etc/vyatta-sysctl.conf || diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index d8e30961..7f2b84b2 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -178,7 +178,7 @@ if ($dhclient_script == 1) { } if ($restart_ntp == 1) { # this corresponds to what is done in name-server/node.def as a fix for bug 1300 - my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &"; + my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q '^server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &"; system($cmd_ntp_restart); } } |