summaryrefslogtreecommitdiff
path: root/recipes-support/ntp/files/ntpd-init.patch
diff options
context:
space:
mode:
authorAndrii Pientsov <andrii.pientsov@globallogic.com>2020-05-21 08:17:34 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-05-21 13:05:31 +0300
commit1b92cb4c4b8c66f98f0f0c8551ea2be9fc423767 (patch)
treec4408d562a88bee2664965d547d026edb7931c5b /recipes-support/ntp/files/ntpd-init.patch
parent1075148e1dfb701d43349af07f35a5ce36eb1195 (diff)
downloadmeta-mlinux-atmel-1b92cb4c4b8c66f98f0f0c8551ea2be9fc423767.tar.gz
meta-mlinux-atmel-1b92cb4c4b8c66f98f0f0c8551ea2be9fc423767.tar.bz2
meta-mlinux-atmel-1b92cb4c4b8c66f98f0f0c8551ea2be9fc423767.zip
Remove duplicate recipes-support
Diffstat (limited to 'recipes-support/ntp/files/ntpd-init.patch')
-rw-r--r--recipes-support/ntp/files/ntpd-init.patch113
1 files changed, 0 insertions, 113 deletions
diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch
deleted file mode 100644
index 3f8129a..0000000
--- a/recipes-support/ntp/files/ntpd-init.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-diff -Naru orig/ntpd new/ntpd
---- orig/ntpd 2019-12-20 15:28:43.002031942 -0600
-+++ new/ntpd 2019-12-20 15:32:59.138024359 -0600
-@@ -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
-
- DAEMON=/usr/sbin/ntpd
- PIDFILE=/var/run/ntpd.pid
-@@ -22,6 +24,20 @@
-
- # Source function library.
- . /etc/init.d/functions
-+has_gps=0
-+if [[ -f /sys/devices/platform/mts-io/capability/gps ]] ; then
-+ has_gps=$(cat /sys/devices/platform/mts-io/capability/gps)
-+fi
-+
-+if (( has_gps == 0 )) ; then
-+ if [[ -n ${CONFIGFILE_sha256} ]] ; then
-+ NEWCONFIGFILE_sha256=$(sha256sum $CONFIGFILE)
-+ if [[ $NEWCONFIGFILE_sha256 =~ $CONFIGFILE_sha256 ]] ; then
-+ logger -p daemon.notice -s -t etc_ntpd "No GPS, need to configure /etc/ntp.conf"
-+ exit 0
-+ fi
-+ fi
-+fi
-
- # Functions to do individual actions
- settick(){
-@@ -34,13 +50,40 @@
- }
- }
- 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 --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
-+ if [[ -x /usr/sbin/gpsd_settime ]] && ((GPSD_REQUIRED == 1)) && (( has_gps == 1 )) && [[ -f "${GNSSRST}" ]]; then
-+ . /etc/default/gpsd
-+ [[ ${VERBOSE} != no ]] && logger -t 'etc_ntpd' -p daemon.info 'Have a GPS and it is required'
-+ if ((SET_SYSTEM_CLOCK == 1)) && /usr/sbin/gpsd_settime ; then
-+ [[ ${VERBOSE} != no ]] && logger -t 'etc_ntpd' -p daemon.info 'Need to set the time next with ntpd'
-+ # We just set the system time by the GPS. Should be within 2 seconds.
-+ # Now that we are close to the correct system time, we
-+ # 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
-+ echo -n "Starting ntpd: "
-+ start-stop-daemon -N -20 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@"
-+ echo "done"
-+ else
-+ [[ ${VERBOSE} != no ]] && logger -t 'etc_ntpd' -p daemon.info 'Clock not set, try later'
-+ # 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
-+ # 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.
-+ if ((SET_SYSTEM_CLOCK == 1)) ; then
-+ # Sets the clock and exits.
-+ ntpd -gq
-+ shift
-+ fi
-+ 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: "
-@@ -50,8 +93,22 @@
-
- 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 ((${#STATSDIR} > 0)) && ! [[ -d ${STATSDIR} ]] ; then
-+ echo Make ${STATSDIR}
-+ mkdir -m 0755 -p ${STATSDIR}
-+ fi
-+ if [[ -d ${STATSDIR} ]] ; then
-+ chown ntp:ntp ${STATSDIR} >/dev/null 2>&1
-+ fi
-+ fi
-+ settick
-+ startdaemon -g $CONFIGOPT
- ;;
- stop)
- stopdaemon