Skip to contentSkip to conversation

ntp: Create a separate package for sntp

PATCH In review Khem Raj 2 participants 2 messages Apr 16, 2013 – Apr 17, 2013

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 ntp: Create a separate package for sntp

sntp provides the functionality of obsoleted ntpdate so we have option of using ntpd as well as sntp sntp does the immediate one time sync with time server and corrects the tme immediately. it replaces ntpdate nicely.

---
 meta-networking/recipes-support/ntp/ntp.inc        |   13 +++++++++++--
 meta-networking/recipes-support/ntp/ntp/sntp       |    1 +
 .../recipes-support/ntp/ntp/sntp.service           |   11 +++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntp/ntp/sntp
 create mode 100644 meta-networking/recipes-support/ntp/ntp/sntp.service
meta-networking/recipes-support/ntp/ntp.inc +11 -2
index a604b9c..004dc9b 100644
@@ -20,6 +20,8 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
            file://ntpdate.default \
            file://ntpdate.service \
            file://ntpd.service \
+           file://sntp.service \
+           file://sntp \
 "
 
 inherit autotools update-rc.d systemd
@@ -52,15 +54,18 @@ do_install_append() {
 
     install -d ${D}/${sysconfdir}/default
     install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate
+    install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/
+
     install -d ${D}/${sysconfdir}/network/if-up.d
     ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d
 
     install -d ${D}${systemd_unitdir}/system
     install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/
     install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/
+    install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/
 }
 
-PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils"
+PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils sntp"
 # NOTE: you don't need ntpdate, use "ntpd -q -g -x"
 
 # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms
@@ -71,9 +76,10 @@ RPROVIDES_${PN}-utils = "${PN}-bin"
 RREPLACES_${PN}-utils = "${PN}-bin"
 RCONFLICTS_${PN}-utils = "${PN}-bin"
 
-SYSTEMD_PACKAGES = "${PN} ntpdate"
+SYSTEMD_PACKAGES = "${PN} ntpdate sntp"
 SYSTEMD_SERVICE_${PN} = "ntpd.service"
 SYSTEMD_SERVICE_ntpdate = "ntpdate.service"
+SYSTEMD_SERVICE_sntp = "sntp.service"
 
 RPROVIDES_${PN} += "${PN}-systemd"
 RREPLACES_${PN} += "${PN}-systemd"
@@ -94,6 +100,9 @@ FILES_ntpdate = "${bindir}/ntpdate \
     ${sysconfdir}/default/ntpdate \
     ${systemd_unitdir}/system/ntpdate.service \
 "
+FILES_sntp = "${bindir}/sntp \
+              ${sysconfdir}/default/sntp \
+             "
 
 CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
 CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
meta-networking/recipes-support/ntp/ntp/sntp new file +1 -0
new file mode 100644
index 0000000..f8c5895
@@ -0,0 +1 @@
+NTPSERVER="ntpserver.example.org"
meta-networking/recipes-support/ntp/ntp/sntp.service new file +11 -0
new file mode 100644
index 0000000..0f09e43
@@ -0,0 +1,11 @@
+[Unit]
+Description=Simple Network Time Service Client
+After=network.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-/etc/default/sntp
+ExecStart=/usr/bin/sntp -s $NTPSERVER
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
1.7.9.5
Acked-by on v2 1/1
#1 lore raw
Quoted 87 lines · On Tuesday 16 April 2013 13:35:50 Khem Raj wrote:

sntp provides the functionality of obsoleted ntpdate so we have option of using ntpd as well as sntp sntp does the immediate one time sync with time server and corrects the tme immediately. it replaces ntpdate nicely.

---
 meta-networking/recipes-support/ntp/ntp.inc        |   13 +++++++++++--
 meta-networking/recipes-support/ntp/ntp/sntp       |    1 +
 .../recipes-support/ntp/ntp/sntp.service           |   11 +++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntp/ntp/sntp
 create mode 100644 meta-networking/recipes-support/ntp/ntp/sntp.service
(quoted diff) +0 -0

b/meta-networking/recipes-support/ntp/ntp.inc index a604b9c..004dc9b 100644

meta-networking/recipes-support/ntp/ntp.inc +0 -0
@@ -20,6 +20,8 @@ SRC_URI =

"http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g

file://ntpdate.default \
            file://ntpdate.service \
            file://ntpd.service \
meta-networking/recipes-support/ntp/ntp.inc +2 -0
+           file://sntp.service \
+           file://sntp \
 "
 
 inherit autotools update-rc.d systemd
@@ -52,15 +54,18 @@ do_install_append() {
 
     install -d ${D}/${sysconfdir}/default
     install -m 644 ${WORKDIR}/ntpdate.default

${D}${sysconfdir}/default/ntpdate + install -m 0644 ${WORKDIR}/sntp
${D}${sysconfdir}/default/
+

     install -d ${D}/${sysconfdir}/network/if-up.d
     ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d

     install -d ${D}${systemd_unitdir}/system
     install -m 0644 ${WORKDIR}/ntpdate.service

${D}${systemd_unitdir}/system/ install -m 0644 ${WORKDIR}/ntpd.service
${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/sntp.service
${D}${systemd_unitdir}/system/ }

meta-networking/recipes-support/ntp/ntp.inc +1 -1
-PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils"
+PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils sntp"
 # NOTE: you don't need ntpdate, use "ntpd -q -g -x"
 
 # ntp originally includes tickadj. It's split off for inclusion in small

firmware images on platforms @@ -71,9 +76,10 @@ RPROVIDES_${PN}-utils = "${PN}-bin"
RREPLACES_${PN}-utils = "${PN}-bin"
RCONFLICTS_${PN}-utils = "${PN}-bin"

meta-networking/recipes-support/ntp/ntp.inc +5 -1
-SYSTEMD_PACKAGES = "${PN} ntpdate"
+SYSTEMD_PACKAGES = "${PN} ntpdate sntp"
 SYSTEMD_SERVICE_${PN} = "ntpd.service"
 SYSTEMD_SERVICE_ntpdate = "ntpdate.service"
+SYSTEMD_SERVICE_sntp = "sntp.service"
 
 RPROVIDES_${PN} += "${PN}-systemd"
 RREPLACES_${PN} += "${PN}-systemd"
@@ -94,6 +100,9 @@ FILES_ntpdate = "${bindir}/ntpdate \
     ${sysconfdir}/default/ntpdate \
     ${systemd_unitdir}/system/ntpdate.service \
 "
+FILES_sntp = "${bindir}/sntp \
+              ${sysconfdir}/default/sntp \
+             "
 
 CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
 CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
(quoted diff) +0 -0

b/meta-networking/recipes-support/ntp/ntp/sntp new file mode 100644 index 0000000..f8c5895

meta-networking/recipes-support/ntp/ntp/sntp new file +1 -0
@@ -0,0 +1 @@
+NTPSERVER="ntpserver.example.org"
(quoted diff) +0 -0

b/meta-networking/recipes-support/ntp/ntp/sntp.service new file mode 100644 index 0000000..0f09e43

meta-networking/recipes-support/ntp/ntp/sntp.service new file +1 -0
@@ -0,0 +1,11 @@
+[Unit]

meta-networking/recipes-support/ntp/ntp/sntp.service line 11

Quoted 10 lines
meta-networking/recipes-support/ntp/ntp/sntp.service new file +10 -0
+Description=Simple Network Time Service Client
+After=network.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-/etc/default/sntp
+ExecStart=/usr/bin/sntp -s $NTPSERVER
+
+[Install]
+WantedBy=multi-user.target
Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre