diff options
Diffstat (limited to 'recipes-support-ivi/ntp/files')
-rwxr-xr-x[-rw-r--r--] | recipes-support-ivi/ntp/files/ntp | 62 | ||||
-rw-r--r-- | recipes-support-ivi/ntp/files/ntp-4.2.4_p6-nano.patch | 34 | ||||
-rw-r--r-- | recipes-support-ivi/ntp/files/ntp.conf | 28 | ||||
-rwxr-xr-x | recipes-support-ivi/ntp/files/ntpd | 62 | ||||
-rw-r--r-- | recipes-support-ivi/ntp/files/ntpd.service | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | recipes-support-ivi/ntp/files/ntpdate | 98 | ||||
-rw-r--r-- | recipes-support-ivi/ntp/files/ntpdate.service | 22 | ||||
-rw-r--r-- | recipes-support-ivi/ntp/files/tickadj.c.patch | 64 |
8 files changed, 227 insertions, 165 deletions
diff --git a/recipes-support-ivi/ntp/files/ntp b/recipes-support-ivi/ntp/files/ntp index e943d66..e91a528 100644..100755 --- a/recipes-support-ivi/ntp/files/ntp +++ b/recipes-support-ivi/ntp/files/ntp @@ -1,31 +1,31 @@ -#! /bin/sh
-
-FLAGS="defaults 23"
-
-test -f /usr/bin/ntpd || exit 0
-
-case "$1" in
- start)
- echo -n "Starting NTP server: ntpd"
- start-stop-daemon --start --quiet --exec /usr/bin/ntpd
- echo "."
- ;;
- stop)
- echo -n "Stopping NTP server: ntpd"
- start-stop-daemon --stop --quiet --exec /usr/bin/ntpd
- echo "."
- ;;
- restart|force-reload)
- echo -n "Restarting NTP server: ntpd... "
- start-stop-daemon --stop --quiet --exec /usr/bin/ntpd
- sleep 2
- start-stop-daemon --start --quiet --exec /usr/bin/ntpd
- echo "done."
- ;;
- *)
- echo "Usage: /etc/init.d/ntp {start|stop|restart|force-reload}"
- exit 1
- ;;
-esac
-
-exit 0
+#! /bin/sh + +FLAGS="defaults 23" + +test -f /usr/bin/ntpd || exit 0 + +case "$1" in + start) + echo -n "Starting NTP server: ntpd" + start-stop-daemon --start --quiet --exec /usr/bin/ntpd + echo "." + ;; + stop) + echo -n "Stopping NTP server: ntpd" + start-stop-daemon --stop --quiet --exec /usr/bin/ntpd + echo "." + ;; + restart|force-reload) + echo -n "Restarting NTP server: ntpd... " + start-stop-daemon --stop --quiet --exec /usr/bin/ntpd + sleep 2 + start-stop-daemon --start --quiet --exec /usr/bin/ntpd + echo "done." + ;; + *) + echo "Usage: /etc/init.d/ntp {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-support-ivi/ntp/files/ntp-4.2.4_p6-nano.patch b/recipes-support-ivi/ntp/files/ntp-4.2.4_p6-nano.patch index a5004f7..cb1e2f7 100644 --- a/recipes-support-ivi/ntp/files/ntp-4.2.4_p6-nano.patch +++ b/recipes-support-ivi/ntp/files/ntp-4.2.4_p6-nano.patch @@ -1,17 +1,17 @@ ---- a/include/ntp_syscall.h.orig 2009-05-19 16:44:55.048156467 -0400
-+++ b/include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400
-@@ -14,6 +14,14 @@
- # include <sys/timex.h>
- #endif
-
-+#if defined(ADJ_NANO) && !defined(MOD_NANO)
-+#define MOD_NANO ADJ_NANO
-+#endif
-+
-+#if defined(ADJ_TAI) && !defined(MOD_TAI)
-+#define MOD_TAI ADJ_TAI
-+#endif
-+
- #ifndef NTP_SYSCALLS_LIBC
- #ifdef NTP_SYSCALLS_STD
- # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t))
+--- a/include/ntp_syscall.h.orig 2009-05-19 16:44:55.048156467 -0400 ++++ b/include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400 +@@ -14,6 +14,14 @@ + # include <sys/timex.h> + #endif + ++#if defined(ADJ_NANO) && !defined(MOD_NANO) ++#define MOD_NANO ADJ_NANO ++#endif ++ ++#if defined(ADJ_TAI) && !defined(MOD_TAI) ++#define MOD_TAI ADJ_TAI ++#endif ++ + #ifndef NTP_SYSCALLS_LIBC + #ifdef NTP_SYSCALLS_STD + # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) diff --git a/recipes-support-ivi/ntp/files/ntp.conf b/recipes-support-ivi/ntp/files/ntp.conf index 5a12db2..bf52440 100644 --- a/recipes-support-ivi/ntp/files/ntp.conf +++ b/recipes-support-ivi/ntp/files/ntp.conf @@ -1,14 +1,14 @@ -# This is the most basic ntp configuration file
-# The driftfile must remain in a place specific to this
-# machine - it records the machine specific clock error
-driftfile /etc/ntp.drift
-# This obtains a random server which will be close
-# (in IP terms) to the machine. Add other servers
-# as required, or change this.
-server pool.ntp.org
-# Using local hardware clock as fallback
-# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself
-server 127.127.1.0
-fudge 127.127.1.0 stratum 14
-# Defining a default security setting
-restrict default
+# This is the most basic ntp configuration file +# The driftfile must remain in a place specific to this +# machine - it records the machine specific clock error +driftfile /etc/ntp.drift +# This obtains a random server which will be close +# (in IP terms) to the machine. Add other servers +# as required, or change this. +server pool.ntp.org +# Using local hardware clock as fallback +# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself +server 127.127.1.0 +fudge 127.127.1.0 stratum 14 +# Defining a default security setting +restrict default diff --git a/recipes-support-ivi/ntp/files/ntpd b/recipes-support-ivi/ntp/files/ntpd new file mode 100755 index 0000000..ae50f13 --- /dev/null +++ b/recipes-support-ivi/ntp/files/ntpd @@ -0,0 +1,62 @@ +#! /bin/sh +# +# ntpd init.d script for ntpdc from ntp.isc.org +test -x /usr/bin/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/bin/tickadj && { + echo -n "Setting tick to $TICKADJ: " + /usr/bin/tickadj "$TICKADJ" + echo "done" + } +} +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/bin/ntpd -- -p /var/run/ntp.pid "$@" + echo "done" +} +stopdaemon(){ + echo -n "Stopping ntpd: " + start-stop-daemon --stop -p /var/run/ntp.pid + echo "done" +} + +case "$1" in + start) + 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-ivi/ntp/files/ntpd.service b/recipes-support-ivi/ntp/files/ntpd.service index d349f9c..bd87b1e 100644 --- a/recipes-support-ivi/ntp/files/ntpd.service +++ b/recipes-support-ivi/ntp/files/ntpd.service @@ -1,11 +1,11 @@ -[Unit]
-Description=Network Time Service
-After=network.target
-
-[Service]
-Type=forking
-PIDFile=/run/ntpd.pid
-ExecStart=/usr/bin/ntpd -p /run/ntpd.pid
-
-[Install]
-WantedBy=multi-user.target
+[Unit] +Description=Network Time Service +After=network.target + +[Service] +Type=forking +PIDFile=/run/ntpd.pid +ExecStart=/usr/bin/ntpd -p /run/ntpd.pid + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support-ivi/ntp/files/ntpdate b/recipes-support-ivi/ntp/files/ntpdate index 6bc8fb1..784b029 100644..100755 --- a/recipes-support-ivi/ntp/files/ntpdate +++ b/recipes-support-ivi/ntp/files/ntpdate @@ -1,49 +1,49 @@ -#!/bin/sh
-
-PATH=/sbin:/bin:/usr/bin
-
-test -x /usr/bin/ntpdate || exit 0
-
-if test -f /etc/default/ntpdate ; then
-. /etc/default/ntpdate
-else
-NTPSERVERS="pool.ntp.org"
-fi
-
-test -n "$NTPSERVERS" || exit 0
-
-# 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/bin/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
-
-) &
+#!/bin/sh + +PATH=/sbin:/bin:/usr/bin + +test -x /usr/bin/ntpdate || exit 0 + +if test -f /etc/default/ntpdate ; then +. /etc/default/ntpdate +else +NTPSERVERS="pool.ntp.org" +fi + +test -n "$NTPSERVERS" || exit 0 + +# 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/bin/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 + +) & diff --git a/recipes-support-ivi/ntp/files/ntpdate.service b/recipes-support-ivi/ntp/files/ntpdate.service index 97ebb3c..b2bc632 100644 --- a/recipes-support-ivi/ntp/files/ntpdate.service +++ b/recipes-support-ivi/ntp/files/ntpdate.service @@ -1,11 +1,11 @@ -[Unit]
-Description=Network Time Service (one-shot ntpdate mode)
-Before=ntpd.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/bin/ntpd -q -g -x
-RemainAfterExit=yes
-
-[Install]
-WantedBy=multi-user.target
+[Unit] +Description=Network Time Service (one-shot ntpdate mode) +Before=ntpd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/ntpd -q -g -x +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support-ivi/ntp/files/tickadj.c.patch b/recipes-support-ivi/ntp/files/tickadj.c.patch index b8bceda..9ef9de9 100644 --- a/recipes-support-ivi/ntp/files/tickadj.c.patch +++ b/recipes-support-ivi/ntp/files/tickadj.c.patch @@ -1,32 +1,32 @@ -Index: ntp-4.2.2p3-r0/ntp-4.2.2p3/util/tickadj.c
-===================================================================
---- ntp-4.2.2p3/util/tickadj.c 2004-02-25 06:58:33.000000000 +0100
-+++ ntp-4.2.2p3/util/tickadj.c 2007-07-07 01:00:54.000000000 +0200
-@@ -21,7 +21,8 @@
- # include <unistd.h>
- #endif /* HAVE_UNISTD_H */
-
--#ifdef HAVE___ADJTIMEX /* Linux */
-+/* proper handling here has been moved to upstream ntp bugzilla */
-+#ifdef linux
-
- #include <sys/timex.h>
- struct timex txc;
-@@ -91,7 +92,7 @@
- }
-
- if (!errflg) {
-- if (__adjtimex(&txc) < 0)
-+ if (adjtimex(&txc) < 0)
- perror("adjtimex");
- else if (!quiet)
- printf("tick = %ld\ntick_adj = %d\n",
-@@ -146,7 +147,7 @@
- #endif
- }
-
-- if (__adjtimex(&txc) < 0)
-+ if (adjtimex(&txc) < 0)
- {
- perror("adjtimex");
- }
+Index: ntp-4.2.2p3-r0/ntp-4.2.2p3/util/tickadj.c +=================================================================== +--- ntp-4.2.2p3/util/tickadj.c 2004-02-25 06:58:33.000000000 +0100 ++++ ntp-4.2.2p3/util/tickadj.c 2007-07-07 01:00:54.000000000 +0200 +@@ -21,7 +21,8 @@ + # include <unistd.h> + #endif /* HAVE_UNISTD_H */ + +-#ifdef HAVE___ADJTIMEX /* Linux */ ++/* proper handling here has been moved to upstream ntp bugzilla */ ++#ifdef linux + + #include <sys/timex.h> + struct timex txc; +@@ -91,7 +92,7 @@ + } + + if (!errflg) { +- if (__adjtimex(&txc) < 0) ++ if (adjtimex(&txc) < 0) + perror("adjtimex"); + else if (!quiet) + printf("tick = %ld\ntick_adj = %d\n", +@@ -146,7 +147,7 @@ + #endif + } + +- if (__adjtimex(&txc) < 0) ++ if (adjtimex(&txc) < 0) + { + perror("adjtimex"); + } |