Skip to content

Commit

Permalink
ntp: drop the deprecated ntpdate
Browse files Browse the repository at this point in the history
The combination of ntpd and sntp now implements the functions of
ntpdate, which has been deprecated.
Now we don't need ntpdate anymore, and we can use the following
command 'ntpd -q -g -x' instead.
So drop the related section of ntpdate now.

Signed-off-by: Zhixiong Chi <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
ZhixiongChi authored and kraj committed Mar 17, 2023
1 parent bf49bde commit 6315006
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 116 deletions.
59 changes: 0 additions & 59 deletions meta-networking/recipes-support/ntp/ntp/ntpdate

This file was deleted.

7 changes: 0 additions & 7 deletions meta-networking/recipes-support/ntp/ntp/ntpdate.default

This file was deleted.

11 changes: 0 additions & 11 deletions meta-networking/recipes-support/ntp/ntp/ntpdate.service

This file was deleted.

47 changes: 8 additions & 39 deletions meta-networking/recipes-support/ntp/ntp_4.2.8p15.bb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
file://0001-sntp-Fix-types-in-check-for-pthread_detach.patch \
file://ntpd \
file://ntp.conf \
file://ntpdate \
file://ntpdate.default \
file://ntpdate.service \
file://ntpd.service \
file://sntp.service \
file://sntp \
Expand Down Expand Up @@ -95,18 +92,15 @@ 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

install -m 755 -d ${D}${NTP_USER_HOME}
chown ntp:ntp ${D}${NTP_USER_HOME}

# Fix hardcoded paths in scripts
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
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
sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace
sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace
sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait
Expand All @@ -115,26 +109,21 @@ do_install:append() {
sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj

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/

install -d ${D}${systemd_unitdir}/ntp-units.d
install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list

# Remove an empty libexecdir.
# Remove the empty libexecdir and bindir.
rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
rmdir --ignore-fail-on-non-empty ${D}${bindir}
}

PACKAGES += "ntpdate sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils"
# NOTE: you don't need ntpdate, use "ntpd -q -g -x"
PACKAGES += "sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils"

# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms
# with wonky clocks (e.g. OpenSlug)
Expand All @@ -149,20 +138,15 @@ RCONFLICTS:${PN}-utils = "${PN}-bin"
# ntpdc and ntpq were split out of ntp-utils
RDEPENDS:${PN}-utils = "ntpdc ntpq"

SYSTEMD_PACKAGES = "${PN} ntpdate sntp"
SYSTEMD_PACKAGES = "${PN} sntp"
SYSTEMD_SERVICE:${PN} = "ntpd.service"
SYSTEMD_SERVICE:ntpdate = "ntpdate.service"
SYSTEMD_SERVICE:sntp = "sntp.service"
SYSTEMD_AUTO_ENABLE:sntp = "disable"

RPROVIDES:${PN} += "${PN}-systemd"
RREPLACES:${PN} += "${PN}-systemd"
RCONFLICTS:${PN} += "${PN}-systemd"

RPROVIDES:ntpdate += "ntpdate-systemd"
RREPLACES:ntpdate += "ntpdate-systemd"
RCONFLICTS:ntpdate += "ntpdate-systemd"

RSUGGESTS:${PN} = "iana-etc"

FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd \
Expand All @@ -172,12 +156,6 @@ FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/n
FILES:${PN}-tickadj = "${sbindir}/tickadj"
FILES:${PN}-utils = "${sbindir} ${datadir}/ntp/lib"
RDEPENDS:${PN}-utils += "perl"
FILES:ntpdate = "${sbindir}/ntpdate \
${sysconfdir}/network/if-up.d/ntpdate-sync \
${bindir}/ntpdate-sync \
${sysconfdir}/default/ntpdate \
${systemd_unitdir}/system/ntpdate.service \
"
FILES:sntp = "${sbindir}/sntp \
${sysconfdir}/default/sntp \
${systemd_unitdir}/system/sntp.service \
Expand All @@ -186,20 +164,11 @@ FILES:ntpdc = "${sbindir}/ntpdc"
FILES:ntpq = "${sbindir}/ntpq"

CONFFILES:${PN} = "${sysconfdir}/ntp.conf"
CONFFILES:ntpdate = "${sysconfdir}/default/ntpdate"

INITSCRIPT_NAME = "ntpd"
# No dependencies, so just go in at the standard level (20)
INITSCRIPT_PARAMS = "defaults"

pkg_postinst:ntpdate() {
if ! grep -q -s ntpdate $D/var/spool/cron/root; then
echo "adding crontab"
test -d $D/var/spool/cron || mkdir -p $D/var/spool/cron
echo "30 * * * * ${bindir}/ntpdate-sync silent" >> $D/var/spool/cron/root
fi
}

inherit update-alternatives

ALTERNATIVE_PRIORITY = "100"
Expand Down

0 comments on commit 6315006

Please sign in to comment.