Skip to contentSkip to conversation

ntp fixes

PATCH In review Paul Eggleton 5 participants 11 messages Nov 22, 2012 – Dec 4, 2012

lore
Share & tools
lore
#0 lore raw

v2 cover ntp fixes

Changes since v1:
* Fix hardcoded paths in scripts
* Move contents of ntp-bin package to previously empty ntp-utils package
* Move the ntp server configuration to runtime (/etc/default/ntpdate)
* Specify configuration files using CONFFILES
* Remove unused init script path from FILES_ntpdate

The following changes since commit d08ee5a51d4e89ae587d170f8b99062689841428:

qt4-embedded: drop bbappend for 4.8.1 (2012-11-22 09:48:36 +0100)

are available in the git repository at:

git://git.openembedded.org/meta-openembedded-contrib paule/ntp
http://cgit.openembedded.org/cgit.cgi/meta-openembedded-contrib/log/?h=paule/ntp

Paul Eggleton (2):
ntp: cleanup recipes and fix SSL support
ntp: make servers configurable and default to none configured

 meta-networking/recipes-support/ntp/files/ntp      |   31 -------
 meta-networking/recipes-support/ntp/files/ntp.conf |    2 +-
 meta-networking/recipes-support/ntp/files/ntpdate  |   11 ++-
 .../recipes-support/ntp/files/ntpdate.default      |    7 ++
 .../recipes-support/ntp/files/openssl-check.patch  |   59 ++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   94 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +--------
 8 files changed, 154 insertions(+), 105 deletions(-)
 delete mode 100755 meta-networking/recipes-support/ntp/files/ntp
 create mode 100644 meta-networking/recipes-support/ntp/files/ntpdate.default
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v2 2/2 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.)

---
 meta-networking/recipes-support/ntp/files/ntp.conf |    2 +-
 meta-networking/recipes-support/ntp/files/ntpdate  |   11 ++++++---
 .../recipes-support/ntp/files/ntpdate.default      |    7 ++++++
 meta-networking/recipes-support/ntp/ntp.inc        |   25 +++++++++++++-------
 4 files changed, 32 insertions(+), 13 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntp/files/ntpdate.default
meta-networking/recipes-support/ntp/files/ntp.conf +1 -1
index bf52440..a9cc838 100644
@@ -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
meta-networking/recipes-support/ntp/files/ntpdate +8 -3
index 784b029..ab0551c 100755
@@ -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
meta-networking/recipes-support/ntp/files/ntpdate.default new file +7 -0
new file mode 100644
index 0000000..486b6e0
@@ -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"
+
meta-networking/recipes-support/ntp/ntp.inc +16 -9
index a614e3f..b3586dc 100644
@@ -17,6 +17,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
            file://ntpd \
            file://ntp.conf \
            file://ntpdate \
+           file://ntpdate.default \
            "
 
 inherit autotools update-rc.d
@@ -37,15 +38,20 @@ 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}${bindir}
+	install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
 
 	# Fix hardcoded paths in scripts
-	sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd
-	sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd
-	sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd
-	sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd
-
-	install -d ${D}${sysconfdir}/network/if-up.d
-	install -m 755 ${WORKDIR}/ntpdate ${D}${sysconfdir}/network/if-up.d
+	sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
+	sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
+	sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
+	sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
+	sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync
+
+	install -d ${D}/${sysconfdir}/default
+	install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate
+	install -d ${D}/${sysconfdir}/network/if-up.d
+	ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d
 }
 
 PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils"
@@ -64,9 +70,10 @@ RSUGGESTS_${PN} = "iana-etc"
 FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}"
 FILES_${PN}-tickadj = "${bindir}/tickadj"
 FILES_${PN}-utils = "${bindir}"
-FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate"
+FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate-sync ${bindir}/ntpdate-sync ${sysconfdir}/default/ntpdate"
 
 CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
+CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
 
 INITSCRIPT_NAME = "ntpd"
 # No dependencies, so just go in at the standard level (20)
@@ -79,7 +86,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 * * * *    ${bindir}/ntpdate-sync silent" >> /var/spool/cron/root
         fi
 fi
 }
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/2 ntp: cleanup recipes and fix SSL support

In reply to Paul Eggleton

* Move common definitions to the inc file
* Drop override of do_configure which doesn't seem to be needed anymore
* Fold ntp-ssl into the ntp recipe as a PACKAGECONFIG option for those who want it (default to off) and fix configure-time checks to detect OpenSSL properly so that it gets enabled when selected
* Remove ntp-bin package and put its contents in currently empty ntp-utils package (with migration path)
* Fix hardcoded paths in ntpd initscript
* Specify ntpd.conf as a configuration file for packaging purposes
* Rearrange so that packaging definitions are towards the end in the expected order
* Delete unused "ntp" initscript file
* Add SUMMARY
* Update HOMEPAGE

This reapplies some of the changes from the original patch by Morgan Little <[email protected]>.

---
 meta-networking/recipes-support/ntp/files/ntp      |   31 -------
 .../recipes-support/ntp/files/openssl-check.patch  |   59 +++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   87 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +---------
 5 files changed, 131 insertions(+), 101 deletions(-)
 delete mode 100755 meta-networking/recipes-support/ntp/files/ntp
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb
meta-networking/recipes-support/ntp/files/ntp deleted +0 -31
deleted file mode 100755
index e91a528..0000000
@@ -1,31 +0,0 @@
-#! /bin/sh
-
-FLAGS="defaults 23"
-
-test -f /usr/bin/ntpd || exit 0
-
-case "$1" in
-	start)
-		echo -n "Starting NTP server: ntpd"
-  		start-stop-daemon --start --quiet --exec /usr/bin/ntpd
-		echo "."
-  		;;
-	stop)
-		echo -n "Stopping NTP server: ntpd"
-  		start-stop-daemon --stop --quiet --exec /usr/bin/ntpd
-		echo "."
-  		;;
-	restart|force-reload)
-		echo -n "Restarting NTP server: ntpd... "
-  		start-stop-daemon --stop --quiet --exec /usr/bin/ntpd
-  		sleep 2
-  		start-stop-daemon --start --quiet --exec /usr/bin/ntpd
-		echo "done."
-  		;;
-	*)
-  		echo "Usage: /etc/init.d/ntp {start|stop|restart|force-reload}"
-  		exit 1
-		;;
-esac
-
-exit 0
meta-networking/recipes-support/ntp/files/openssl-check.patch new file +59 -0

59 lines not on this page · raw message

meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb deleted +0 -11
deleted file mode 100644
index a158990..0000000
@@ -1,11 +0,0 @@
-require ntp_${PV}.bb
-DEPENDS = "openssl"
-
-S = "${WORKDIR}/ntp-${PV}"
-
-EXTRA_OECONF = "--with-openssl-libdir=${STAGING_LIBDIR} \
-	        --with-openssl-incdir=${STAGING_INCDIR}/openssl"
-
-
-SRC_URI[md5sum] = "98e16c7aa4ecd4c004b51bff18962e95"
-SRC_URI[sha256sum] = "9f4a5271a285d390c9225e3ea28f70049ea377d30fc6de4659007cfff278671a"
meta-networking/recipes-support/ntp/ntp.inc +69 -18

104 lines not on this page · raw message

meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb +3 -41

48 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#8 lore raw

Re: [meta-networking][PATCH v2 2/2] ntp: make servers configurable and default to none configured

In reply to Paul Eggleton
Quoted 8 lines · On Thursday 22 November 2012 16:49:35 Paul Eggleton wrote:

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,

Martin points out that should be "/etc/default/ntpdate" not "/etc/default/ntpdate.default" - I have fixed the commit message on the branch.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
Acked-by on the v2 series
#9 lore raw
In reply to Paul Eggleton
Quoted 6 lines · Paul Eggleton

Changes since v1:
* Fix hardcoded paths in scripts
* Move contents of ntp-bin package to previously empty ntp-utils package
* Move the ntp server configuration to runtime (/etc/default/ntpdate)
* Specify configuration files using CONFFILES
* Remove unused init script path from FILES_ntpdate

Finally no need to see failed ntp* in systemd log, Thanks!

Quoted 35 lines

The following changes since commit d08ee5a51d4e89ae587d170f8b99062689841428:

qt4-embedded: drop bbappend for 4.8.1 (2012-11-22 09:48:36 +0100)

are available in the git repository at:

git://git.openembedded.org/meta-openembedded-contrib paule/ntp
http://cgit.openembedded.org/cgit.cgi/meta-openembedded-contrib/log/?h=paule/ntp

Paul Eggleton (2):
ntp: cleanup recipes and fix SSL support
ntp: make servers configurable and default to none configured

 meta-networking/recipes-support/ntp/files/ntp      |   31 -------
 meta-networking/recipes-support/ntp/files/ntp.conf |    2 +-
 meta-networking/recipes-support/ntp/files/ntpdate  |   11 ++-
 .../recipes-support/ntp/files/ntpdate.default      |    7 ++
 .../recipes-support/ntp/files/openssl-check.patch  |   59 ++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   94 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +--------
 8 files changed, 154 insertions(+), 105 deletions(-)
 delete mode 100755 meta-networking/recipes-support/ntp/files/ntp
 create mode 100644 meta-networking/recipes-support/ntp/files/ntpdate.default
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb
Signature · 7 lines
1.7.9.5


_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#10 lore raw
In reply to Paul Eggleton
Quoted 21 lines · [[oe] [meta-networking][PATCH v2 0/2] ntp fixes] On 12.11.22 (Thu 16:49) Paul…

Changes since v1:
* Fix hardcoded paths in scripts
* Move contents of ntp-bin package to previously empty ntp-utils package
* Move the ntp server configuration to runtime (/etc/default/ntpdate)
* Specify configuration files using CONFFILES
* Remove unused init script path from FILES_ntpdate

The following changes since commit d08ee5a51d4e89ae587d170f8b99062689841428:

qt4-embedded: drop bbappend for 4.8.1 (2012-11-22 09:48:36 +0100)

are available in the git repository at:

git://git.openembedded.org/meta-openembedded-contrib paule/ntp
http://cgit.openembedded.org/cgit.cgi/meta-openembedded-contrib/log/?h=paule/ntp

Paul Eggleton (2):
ntp: cleanup recipes and fix SSL support
ntp: make servers configurable and default to none configured

Quoted 14 lines
 meta-networking/recipes-support/ntp/files/ntp      |   31 -------
 meta-networking/recipes-support/ntp/files/ntp.conf |    2 +-
 meta-networking/recipes-support/ntp/files/ntpdate  |   11 ++-
 .../recipes-support/ntp/files/ntpdate.default      |    7 ++
 .../recipes-support/ntp/files/openssl-check.patch  |   59 ++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   94 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +--------
 8 files changed, 154 insertions(+), 105 deletions(-)
 delete mode 100755 meta-networking/recipes-support/ntp/files/ntp
 create mode 100644 meta-networking/recipes-support/ntp/files/ntpdate.default
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb

Merged. Thanks.

Signature · 2 lines
-Joe MacDonald.
:wq
#2 lore raw

[danny?] Re: [meta-networking][PATCH v2 1/2] ntp: cleanup recipes and fix SSL support

In reply to Paul Eggleton

Hi,

Quoted 6 lines · Paul Eggleton

* Move common definitions to the inc file
* Drop override of do_configure which doesn't seem to be needed anymore
* Fold ntp-ssl into the ntp recipe as a PACKAGECONFIG option for those who want it (default to off) and fix configure-time checks to detect OpenSSL properly so that it gets enabled when selected
* Remove ntp-bin package and put its contents in currently empty

Quoted 8 lines

ntp-utils package (with migration path)
* Fix hardcoded paths in ntpd initscript
* Specify ntpd.conf as a configuration file for packaging purposes
* Rearrange so that packaging definitions are towards the end in the expected order
* Delete unused "ntp" initscript file
* Add SUMMARY
* Update HOMEPAGE

Would this patch be acceptable for a push to danny? Or is it to intrusive?

If it's to intrusive, we need to update the SRC_URI checksums in danny, as they're currently not matching the downloaded file...

If needed, I can create a SRC_URI-patch for danny, though I'd prefer to get this one in if possible.

Cheers,
/Anders

Signature · 2 lines
Anders Darander
ChargeStorm AB / eStorm AB
#3 lore raw

Re: [danny?] Re: [meta-networking][PATCH v2 1/2] ntp: cleanup recipes and fix SSL support

Quoted 16 lines · On Tuesday 04 December 2012 08:44:30 Anders Darander wrote:
Quoted 6 lines · Paul Eggleton

* Move common definitions to the inc file
* Drop override of do_configure which doesn't seem to be needed anymore
* Fold ntp-ssl into the ntp recipe as a PACKAGECONFIG option for those who want it (default to off) and fix configure-time checks to detect OpenSSL properly so that it gets enabled when selected
* Remove ntp-bin package and put its contents in currently empty

Quoted 8 lines

ntp-utils package (with migration path)
* Fix hardcoded paths in ntpd initscript
* Specify ntpd.conf as a configuration file for packaging purposes
* Rearrange so that packaging definitions are towards the end in the expected order
* Delete unused "ntp" initscript file
* Add SUMMARY
* Update HOMEPAGE

Quoted 8 lines

Would this patch be acceptable for a push to danny? Or is it to intrusive?

If it's to intrusive, we need to update the SRC_URI checksums in danny, as they're currently not matching the downloaded file...

If needed, I can create a SRC_URI-patch for danny, though I'd prefer to get this one in if possible.

IMO the original recipe was horribly broken, so I'd definitely support having this patch applied to danny as well, assuming people have given it a reasonable amount of runtime testing and everything's OK.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#4 lore raw

Re: [danny?] Re: [meta-networking][PATCH v2 1/2] ntp: cleanup recipes and fix SSL support

Quoted 3 lines · Paul Eggleton

IMO the original recipe was horribly broken, so I'd definitely support having this patch applied to danny as well, assuming people have given it a reasonable amount of runtime testing and everything's OK.

It's horribly intrusive but if ntp wasn't usable before, I'm happy to merge it once it's had some testing.

Ross

#5 lore raw

Re: [danny?] Re: [meta-networking][PATCH v2 1/2] ntp: cleanup recipes and fix SSL support

Quoted 7 lines · Ross
Quoted 3 lines · Paul Eggleton

IMO the original recipe was horribly broken, so I'd definitely support having this patch applied to danny as well, assuming people have given it a reasonable amount of runtime testing and everything's OK.

It's horribly intrusive but if ntp wasn't usable before, I'm happy to merge it once it's had some testing.

Of course ntp isn't in oe-core so ignore my opinion. ;)

Ross

#6 lore raw

Re: [danny?] Re: [meta-networking][PATCH v2 1/2] ntp: cleanup recipes and fix SSL support

In reply to Paul Eggleton
Quoted 23 lines · Paul Eggleton
Quoted 22 lines · On Tuesday 04 December 2012 08:44:30 Anders Darander wrote:
Quoted 6 lines · Paul Eggleton

* Move common definitions to the inc file
* Drop override of do_configure which doesn't seem to be needed anymore
* Fold ntp-ssl into the ntp recipe as a PACKAGECONFIG option for those who want it (default to off) and fix configure-time checks to detect OpenSSL properly so that it gets enabled when selected
* Remove ntp-bin package and put its contents in currently empty

Quoted 8 lines

ntp-utils package (with migration path)
* Fix hardcoded paths in ntpd initscript
* Specify ntpd.conf as a configuration file for packaging purposes
* Rearrange so that packaging definitions are towards the end in the expected order
* Delete unused "ntp" initscript file
* Add SUMMARY
* Update HOMEPAGE

Would this patch be acceptable for a push to danny? Or is it to intrusive?

If it's to intrusive, we need to update the SRC_URI checksums in danny, as they're currently not matching the downloaded file...

Quoted 6 lines
Quoted 2 lines

If needed, I can create a SRC_URI-patch for danny, though I'd prefer to get this one in if possible.

IMO the original recipe was horribly broken, so I'd definitely support having this patch applied to danny as well, assuming people have given it a reasonable amount of runtime testing and everything's OK.

I agree and I plan to send pull-request for danny with this today.

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]