summaryrefslogtreecommitdiff
path: root/recipes-support/ntp/files/ntpd-init.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support/ntp/files/ntpd-init.patch')
-rw-r--r--recipes-support/ntp/files/ntpd-init.patch63
1 files changed, 25 insertions, 38 deletions
diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch
index 2ef7e0b..1890e07 100644
--- a/recipes-support/ntp/files/ntpd-init.patch
+++ b/recipes-support/ntp/files/ntpd-init.patch
@@ -1,17 +1,23 @@
-diff -Naur old/ntpd new/ntpd
---- old/ntpd 2017-02-06 09:21:52.607908299 -0600
-+++ new/ntpd 2017-02-06 09:22:52.417169090 -0600
-@@ -1,6 +1,8 @@
+diff -Naru old/ntpd up/ntpd
+--- old/ntpd 2017-05-30 11:08:30.368920821 -0500
++++ up/ntpd 2017-05-30 11:52:42.965527343 -0500
+@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
- #
+
+ ### BEGIN INIT INFO
+ # Provides: ntp
+@@ -9,7 +9,9 @@
+ # Short-Description: Start NTP daemon
+ ### END INIT INFO
+
+. /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,29 @@
+ DAEMON=/usr/sbin/ntpd
+ PIDFILE=/var/run/ntpd.pid
+@@ -34,13 +36,35 @@
}
}
startdaemon(){
@@ -20,7 +26,7 @@ diff -Naur old/ntpd new/ntpd
- # 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 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@"
- 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
@@ -32,7 +38,7 @@ diff -Naur old/ntpd new/ntpd
+ # use the ntpd one shot option to get to less than
+ # 250mS error so that we don't waste time adjusting the clock.
+ /usr/sbin/ntpd -gq
-+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
++ start-stop-daemon -N -20 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@"
+ else
+ # 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"
@@ -43,17 +49,21 @@ diff -Naur old/ntpd new/ntpd
+ ntpd -gq
+ shift
+ fi
-+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@"
++ # 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 -N -20 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@"
++ echo "done"
+ fi
}
stopdaemon(){
echo -n "Stopping ntpd: "
-@@ -34,24 +52,38 @@
+@@ -50,6 +74,20 @@
case "$1" in
start)
-- settick
-- startdaemon -g
+ if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then
+ exit 0
+ fi
@@ -68,29 +78,6 @@ diff -Naur old/ntpd new/ntpd
+ chown ntp:ntp ${STATSDIR} >/dev/null 2>&1
+ fi
+ fi
-+ settick
-+ startdaemon -g $CONFIGOPT
- ;;
- stop)
-- stopdaemon
-+ stopdaemon
- ;;
- force-reload)
-- stopdaemon
-- settick
-+ stopdaemon
-+ settick
+ 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
- ;;