summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-support/ntp/files/ntpd-init.patch57
1 files changed, 49 insertions, 8 deletions
diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch
index fc388f8..05a6a8e 100644
--- a/recipes-support/ntp/files/ntpd-init.patch
+++ b/recipes-support/ntp/files/ntpd-init.patch
@@ -1,11 +1,52 @@
---- old/ntpd 2016-12-19 18:11:58.022663976 -0600
-+++ new/ntpd 2016-12-19 18:12:56.618663852 -0600
-@@ -23,7 +23,7 @@
- # this. If ntpd seems to disappear after a while assume TICKADJ
- # above is set to a totally incorrect value.
- echo -n "Starting ntpd: "
+--- old/ntpd 2017-01-12 18:10:40.208157197 -0600
++++ new/ntpd 2017-01-12 18:14:27.952154318 -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 "$@"
-+ start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
- echo "done"
+- 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: "