From 6315006aadd52e44c15986c9e00ca8162623be85 Mon Sep 17 00:00:00 2001 From: Zhixiong Chi Date: Wed, 15 Mar 2023 20:33:56 -0700 Subject: ntp: drop the deprecated ntpdate 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 Signed-off-by: Khem Raj --- meta-networking/recipes-support/ntp/ntp/ntpdate | 59 ---------------------- .../recipes-support/ntp/ntp/ntpdate.default | 7 --- .../recipes-support/ntp/ntp/ntpdate.service | 11 ---- .../recipes-support/ntp/ntp_4.2.8p15.bb | 47 +++-------------- 4 files changed, 8 insertions(+), 116 deletions(-) delete mode 100755 meta-networking/recipes-support/ntp/ntp/ntpdate delete mode 100644 meta-networking/recipes-support/ntp/ntp/ntpdate.default delete mode 100644 meta-networking/recipes-support/ntp/ntp/ntpdate.service diff --git a/meta-networking/recipes-support/ntp/ntp/ntpdate b/meta-networking/recipes-support/ntp/ntp/ntpdate deleted file mode 100755 index be3bacfcd1..0000000000 --- a/meta-networking/recipes-support/ntp/ntp/ntpdate +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -PATH=/sbin:/bin:/usr/bin:/usr/sbin - -test -x /usr/sbin/ntpdate || exit 0 - -if test -f /etc/default/ntpdate ; then -. /etc/default/ntpdate -fi - -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 -# the system time. Feel free to change this, especially if you regularly -# bring up new network interfaces. -if [ "$METHOD" = static ]; then - OPTS="-b" -fi - -if [ "$METHOD" = loopback ]; then - exit 0 -fi - -( - -LOCKFILE=/var/lock/ntpdate - -# Avoid running more than one at a time -if [ -x /usr/bin/lockfile-create ]; then - lockfile-create $LOCKFILE - lockfile-touch $LOCKFILE & - LOCKTOUCHPID="$!" -fi - -if /usr/sbin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then - if [ "$UPDATE_HWCLOCK" = "yes" ]; then - hwclock --systohc || : - fi -fi - -if [ -x /usr/bin/lockfile-create ] ; then - kill $LOCKTOUCHPID - lockfile-remove $LOCKFILE -fi - -) & - -# wait for all subprocesses to finish -# this is required when using systemd service as ntpd will start before ntpdate finishes -# and results in a bind error (port 123) -wait diff --git a/meta-networking/recipes-support/ntp/ntp/ntpdate.default b/meta-networking/recipes-support/ntp/ntp/ntpdate.default deleted file mode 100644 index 486b6e07d3..0000000000 --- a/meta-networking/recipes-support/ntp/ntp/ntpdate.default +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration script used by ntpdate-sync script - -NTPSERVERS="" - -# Set to "yes" to write time to hardware clock on success -UPDATE_HWCLOCK="no" - diff --git a/meta-networking/recipes-support/ntp/ntp/ntpdate.service b/meta-networking/recipes-support/ntp/ntp/ntpdate.service deleted file mode 100644 index 10cbd70f99..0000000000 --- a/meta-networking/recipes-support/ntp/ntp/ntpdate.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Network Time Service (one-shot ntpdate mode) -Before=ntpd.service - -[Service] -Type=oneshot -ExecStart=/usr/bin/ntpdate-sync silent -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p15.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p15.bb index 2ae53dc640..3ce2d77df7 100644 --- a/meta-networking/recipes-support/ntp/ntp_4.2.8p15.bb +++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p15.bb @@ -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 \ @@ -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 @@ -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) @@ -149,9 +138,8 @@ 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" @@ -159,10 +147,6 @@ 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 \ @@ -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 \ @@ -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" -- cgit v1.2.3-54-g00ecf