From patchwork Wed Nov 21 17:29:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [meta-networking, 2/2] ntp: make servers configurable and default to none configured Date: Wed, 21 Nov 2012 17:29:30 -0000 From: Paul Eggleton X-Patchwork-Id: 39423 Message-Id: <1eef087d214b6c6ff27b60dff5511acfc2a3925e.1353518890.git.paul.eggleton@linux.intel.com> To: openembedded-devel@lists.openembedded.org 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. Signed-off-by: Paul Eggleton --- meta-networking/recipes-support/ntp/ntp.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/meta-networking/recipes-support/ntp/ntp.inc b/meta-networking/recipes-support/ntp/ntp.inc index d20bc2e..b54608a 100644 --- a/meta-networking/recipes-support/ntp/ntp.inc +++ b/meta-networking/recipes-support/ntp/ntp.inc @@ -33,12 +33,22 @@ PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ --without-openssl --without-crypto, \ openssl" +# This should be set in the distro configuration +NTP_SERVERS ??= "" + +python __anonymous() { + if not d.getVar("NTP_SERVERS", True): + raise bb.parse.SkipPackage("Please set NTP_SERVERS in order to build ntp - see http://www.openembedded.org/wiki/NTP for details") +} + do_install_append() { install -d ${D}/${sysconfdir}/init.d install -m 644 ${WORKDIR}/ntp.conf ${D}/${sysconfdir} install -m 755 ${WORKDIR}/ntpd ${D}/${sysconfdir}/init.d install -d ${D}/${sysconfdir}/network/if-up.d install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d + + sed -i "s/pool.ntp.org/${NTP_SERVERS}/g" ${D}/${sysconfdir}/ntp.conf ${D}/${sysconfdir}/network/if-up.d/ntpdate } PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils" @@ -71,7 +81,7 @@ else if ! grep -q -s ntpdate /var/spool/cron/root; then echo "adding crontab" test -d /var/spool/cron || mkdir -p /var/spool/cron - echo "30 * * * * /usr/bin/ntpdate -b -s -u pool.ntp.org" >> /var/spool/cron/root + echo "30 * * * * /usr/bin/ntpdate -b -s -u ${NTP_SERVERS}" >> /var/spool/cron/root fi fi }