summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-support/ntp/files/ntp.init.patch190
-rw-r--r--recipes-support/ntp/files/ntpd-init.patch25
2 files changed, 11 insertions, 204 deletions
diff --git a/recipes-support/ntp/files/ntp.init.patch b/recipes-support/ntp/files/ntp.init.patch
deleted file mode 100644
index b60d8ca..0000000
--- a/recipes-support/ntp/files/ntp.init.patch
+++ /dev/null
@@ -1,190 +0,0 @@
-diff -Naur old/ntpd new/ntpd
---- old/ntpd 2017-02-02 18:00:38.415645575 -0600
-+++ new/ntpd 2017-02-02 18:14:50.986092592 -0600
-@@ -1,6 +1,8 @@
--#! /bin/sh
-+#! /bin/bash
- #
-+. /etc/default/ntpd
- PATH=/sbin:/bin:/usr/bin:/usr/sbin
-+GNSSRST=/sys/devices/platform/mts-io/gnss-reset
-
- # ntpd init.d script for ntpdc from ntp.isc.org
- test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0
-@@ -18,13 +20,32 @@
- }
- }
- startdaemon(){
-- # The -g option allows ntpd to step the time to correct it just
-- # once. The daemon will exit if the clock drifts too much after
-- # this. If ntpd seems to disappear after a while assume TICKADJ
-- # above is set to a totally incorrect value.
-- echo -n "Starting ntpd: "
-- start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
-- echo "done"
-+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd --test -- -u ntp:ntp -p /var/run/ntp.pid "$@" \
-+ || return 1
-+ if ((GPSD_REQUIRED == 1)) && [[ -L /dev/gps0 ]] && [[ -f "${GNSSRST}" ]]; then
-+ . /etc/default/gpsd
-+ # Could not get ntpd -gq to work with the GPS.
-+ # So read the GPS time directly and set the system
-+ # clock.
-+ if ((SET_SYSTEM_CLOCK == 1)) && /usr/sbin/gpsd_ubx_settime ; then
-+ # System time set by the GPS.
-+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
-+ else
-+ # Need a GPS fix before startint ntp.
-+ /usr/sbin/start-stop-daemon -b -n z1e9d3qb -N -20 --start -x /bin/bash -- -c "sleep $GPSD_WAIT_TIME;/etc/init.d/ntpd start"
-+ fi
-+ else
-+ if ((SET_SYSTEM_CLOCK == 1)) ; then
-+ ntpd -gq
-+ shift
-+ fi
-+
-+ # The -g option allows ntpd to step the time to correct it just
-+ # once. The daemon will exit if the clock drifts too much after
-+ # this. If ntpd seems to disappear after a while assume TICKADJ
-+ # above is set to a totally incorrect value.
-+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
-+ fi
- }
- stopdaemon(){
- echo -n "Stopping ntpd: "
-@@ -34,24 +55,37 @@
-
- case "$1" in
- start)
-- settick
-- startdaemon -g
-+ if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then
-+ exit 0
-+ fi
-+ if [[ -n "$CONFIGFILE" ]] ; then
-+ $CONFIGOPT="-c ${CONFIGFILE}"
-+ STATSDIR=$(grep "^statsdir" ${CONFIGFILE} | sed -r 's/[^[:SPACE:]]+[[:SPACE:]]//')
-+ if ! [[ -d ${STATSDIR} ]] ; then
-+ mkdir -m 0755 -p ${STATSDIR}
-+ fi
-+ if [[ -d ${STATSDIR} ]] ; then
-+ chown ntp:ntp ${STATSDIR}
-+ fi
-+ fi
-+ settick
-+ startdaemon -g $CONFIGOPT
- ;;
- stop)
-- stopdaemon
-+ stopdaemon
- ;;
- force-reload)
-- stopdaemon
-- settick
-+ stopdaemon
-+ settick
- startdaemon -g
- ;;
- restart)
-- # Don't reset the tick here
-+ # Don't reset the tick here
- stopdaemon
- startdaemon -g
- ;;
- reload)
-- # Must do this by hand, but don't do -g
-+ # Must do this by hand, but don't do -g
- stopdaemon
- startdaemon
- ;;
-diff -Naur old/ntpd.orig new/ntpd.orig
---- old/ntpd.orig 2017-02-02 17:58:25.316767036 -0600
-+++ new/ntpd.orig 1969-12-31 18:00:00.000000000 -0600
-@@ -1,88 +0,0 @@
--#! /bin/bash
--#
--. /etc/default/ntpd
--PATH=/sbin:/bin:/usr/bin:/usr/sbin
--GNSSRST=/sys/devices/platform/mts-io/gnss-reset
--
--# ntpd init.d script for ntpdc from ntp.isc.org
--test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0
--# rcS contains TICKADJ
--test -r /etc/default/rcS && . /etc/default/rcS
--
--# Functions to do individual actions
--settick(){
-- # If TICKADJ is set we *must* adjust it before we start, because the
-- # driftfile relies on the correct setting
-- test -n "$TICKADJ" -a -x /usr/sbin/tickadj && {
-- echo -n "Setting tick to $TICKADJ: "
-- /usr/sbin/tickadj "$TICKADJ"
-- echo "done"
-- }
--}
--startdaemon(){
-- /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd --test -- -u ntp:ntp -p /var/run/ntp.pid "$@" \
-- || return 1
-- if ((GPSD_REQUIRED == 1)) && [[ -L /dev/gps0 ]] && [[ -f "${GNSSRST}" ]]; then
-- . /etc/default/gpsd
-- # Could not get ntpd -gq to work with the GPS.
-- # So read the GPS time directly and set the system
-- # clock.
-- if ((SET_SYSTEM_CLOCK == 1)) && /usr/sbin/gpsd_ubx_settime ; then
-- # System time set by the GPS.
-- /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
-- else
-- # Need a GPS fix before startint ntp.
-- /usr/sbin/start-stop-daemon -b -n z1e9d3qb -N -20 --start -x /bin/bash -- -c "sleep $GPSD_WAIT_TIME;/etc/init.d/ntpd start"
-- fi
-- else
-- if ((SET_SYSTEM_CLOCK == 1)) ; then
-- ntpd -gq
-- shift
-- fi
--
-- # The -g option allows ntpd to step the time to correct it just
-- # once. The daemon will exit if the clock drifts too much after
-- # this. If ntpd seems to disappear after a while assume TICKADJ
-- # above is set to a totally incorrect value.
-- /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
-- fi
--}
--stopdaemon(){
-- echo -n "Stopping ntpd: "
-- start-stop-daemon --stop -p /var/run/ntp.pid
-- echo "done"
--}
--
--case "$1" in
-- start)
-- if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then
-- exit 0
-- fi
-- settick
-- startdaemon -g
-- ;;
-- stop)
-- stopdaemon
-- ;;
-- force-reload)
-- stopdaemon
-- settick
-- startdaemon -g
-- ;;
-- restart)
-- # Don't reset the tick here
-- stopdaemon
-- startdaemon -g
-- ;;
-- reload)
-- # Must do this by hand, but don't do -g
-- stopdaemon
-- startdaemon
-- ;;
-- *)
-- echo "Usage: ntpd { start | stop | restart | reload }" >&2
-- exit 1
-- ;;
--esac
--
--exit 0
diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch
index 9516084..3ff2823 100644
--- a/recipes-support/ntp/files/ntpd-init.patch
+++ b/recipes-support/ntp/files/ntpd-init.patch
@@ -1,6 +1,6 @@
diff -Naur old/ntpd new/ntpd
---- old/ntpd 2017-02-02 18:00:38.415645575 -0600
-+++ new/ntpd 2017-02-02 19:01:39.766215168 -0600
+--- old/ntpd 2017-02-03 10:11:28.136849640 -0600
++++ new/ntpd 2017-02-03 10:33:58.537991855 -0600
@@ -1,6 +1,8 @@
-#! /bin/sh
+#! /bin/bash
@@ -11,7 +11,7 @@ diff -Naur old/ntpd new/ntpd
# ntpd init.d script for ntpdc from ntp.isc.org
test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0
-@@ -18,13 +20,32 @@
+@@ -18,13 +20,29 @@
}
}
startdaemon(){
@@ -26,32 +26,29 @@ diff -Naur old/ntpd new/ntpd
+ || return 1
+ if ((GPSD_REQUIRED == 1)) && [[ -L /dev/gps0 ]] && [[ -f "${GNSSRST}" ]]; then
+ . /etc/default/gpsd
-+ # Could not get ntpd -gq to work with the GPS.
-+ # So read the GPS time directly and set the system
-+ # clock.
+ if ((SET_SYSTEM_CLOCK == 1)) && /usr/sbin/gpsd_ubx_settime ; then
-+ # System time set by the GPS.
++ # System time set by the GPS. Should be within 2 seconds.
++ # -x option below allows 600 seconds of error. Without -x
++ # we need 128mS accurace, which is not provided by
++ # gpsd_ubx_settime.
++ ntpd -gq
+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
+ else
-+ # Need a GPS fix before startint ntp.
++ # Need a GPS fix before startint ntp. Try again later.
+ /usr/sbin/start-stop-daemon -b -n z1e9d3qb -N -20 --start -x /bin/bash -- -c "sleep $GPSD_WAIT_TIME;/etc/init.d/ntpd start"
+ fi
+ else
+ if ((SET_SYSTEM_CLOCK == 1)) ; then
++ # Sets the clock and exits.
+ ntpd -gq
+ shift
+ fi
-+
-+ # The -g option allows ntpd to step the time to correct it just
-+ # once. The daemon will exit if the clock drifts too much after
-+ # this. If ntpd seems to disappear after a while assume TICKADJ
-+ # above is set to a totally incorrect value.
+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
+ fi
}
stopdaemon(){
echo -n "Stopping ntpd: "
-@@ -34,24 +55,38 @@
+@@ -34,24 +52,38 @@
case "$1" in
start)