From a863b5409923189c3cfa4d82888f94258da96648 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 22 Nov 2012 16:49:35 +0000 Subject: ntp: make servers configurable and default to none configured People can't blindly use pool.ntp.org, especially if they are building for a product or something that could be used in a product, so at least try to get people to do the right thing and not use pool.ntp.org by default. The previous network interface up script is now installed as ntpdate-sync in ${bindir} (and symlinked as the network if-up script). NTPSERVERS needs to be set in /etc/default/ntpdate.default at runtime, or a different version of this file with a default value can be provided in a bbappend. (If you intend to use ntpd you will also want to provide an ntp.conf with the appropriate server(s) set there as well.) Signed-off-by: Paul Eggleton --- meta-networking/recipes-support/ntp/files/ntp.conf | 2 +- meta-networking/recipes-support/ntp/files/ntpdate | 11 ++++++++--- meta-networking/recipes-support/ntp/files/ntpdate.default | 7 +++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 meta-networking/recipes-support/ntp/files/ntpdate.default (limited to 'meta-networking/recipes-support/ntp/files') diff --git a/meta-networking/recipes-support/ntp/files/ntp.conf b/meta-networking/recipes-support/ntp/files/ntp.conf index bf52440ced..a9cc838450 100644 --- a/meta-networking/recipes-support/ntp/files/ntp.conf +++ b/meta-networking/recipes-support/ntp/files/ntp.conf @@ -5,7 +5,7 @@ driftfile /etc/ntp.drift # This obtains a random server which will be close # (in IP terms) to the machine. Add other servers # as required, or change this. -server pool.ntp.org +server time.server.example.com # Using local hardware clock as fallback # Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself server 127.127.1.0 diff --git a/meta-networking/recipes-support/ntp/files/ntpdate b/meta-networking/recipes-support/ntp/files/ntpdate index 784b029ad5..ab0551c5a5 100755 --- a/meta-networking/recipes-support/ntp/files/ntpdate +++ b/meta-networking/recipes-support/ntp/files/ntpdate @@ -6,11 +6,16 @@ test -x /usr/bin/ntpdate || exit 0 if test -f /etc/default/ntpdate ; then . /etc/default/ntpdate -else -NTPSERVERS="pool.ntp.org" fi -test -n "$NTPSERVERS" || exit 0 +if [ "$NTPSERVERS" = "" ] ; then + if [ "$METHOD" = "" -a "$1" != "silent" ] ; then + echo "Please set NTPSERVERS in /etc/default/ntpdate" + exit 1 + else + exit 0 + fi +fi # This is a heuristic: The idea is that if a static interface is brought # up, that is a major event, and we can put in some extra effort to fix diff --git a/meta-networking/recipes-support/ntp/files/ntpdate.default b/meta-networking/recipes-support/ntp/files/ntpdate.default new file mode 100644 index 0000000000..486b6e07d3 --- /dev/null +++ b/meta-networking/recipes-support/ntp/files/ntpdate.default @@ -0,0 +1,7 @@ +# Configuration script used by ntpdate-sync script + +NTPSERVERS="" + +# Set to "yes" to write time to hardware clock on success +UPDATE_HWCLOCK="no" + -- cgit v1.2.3-54-g00ecf