diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-17 21:41:22 +0100 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-17 21:41:22 +0100 |
commit | c58cc7d3796dcee6e93885c835ed04cb566abeb2 (patch) | |
tree | 3eea4d4ef6a4ef79e0f4e025d7012c1a5cc38835 /meta-oe/recipes-support/ntp | |
parent | eec6ab97f712e06eb52c9f7c99e19ffab3ce9d74 (diff) | |
download | meta-openembedded-c58cc7d3796dcee6e93885c835ed04cb566abeb2.tar.gz |
move layer into meta-oe in preparation for future splits
As per TSC decision
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-support/ntp')
-rw-r--r-- | meta-oe/recipes-support/ntp/files/hipox/ntp.conf | 13 | ||||
-rwxr-xr-x | meta-oe/recipes-support/ntp/files/hipox/ntpd | 62 | ||||
-rwxr-xr-x | meta-oe/recipes-support/ntp/files/ntp | 31 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch | 17 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/files/ntp.conf | 13 | ||||
-rwxr-xr-x | meta-oe/recipes-support/ntp/files/ntpd | 62 | ||||
-rwxr-xr-x | meta-oe/recipes-support/ntp/files/ntpdate | 49 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/files/tickadj.c.patch | 32 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/ntp-ssl_4.2.6p3.bb | 11 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/ntp.inc | 33 | ||||
-rw-r--r-- | meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb | 46 |
11 files changed, 369 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/ntp/files/hipox/ntp.conf b/meta-oe/recipes-support/ntp/files/hipox/ntp.conf new file mode 100644 index 000000000..57e585c17 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/hipox/ntp.conf | |||
@@ -0,0 +1,13 @@ | |||
1 | # This is the most basic ntp configuration file | ||
2 | # The driftfile must remain in a place specific to this | ||
3 | # machine - it records the machine specific clock error | ||
4 | driftfile /etc/ntp.drift | ||
5 | # This obtains a random server which will be close | ||
6 | # (in IP terms) to the machine. Add other servers | ||
7 | # as required, or change this. | ||
8 | #server pool.ntp.org | ||
9 | # Using local hardware clock as fallback | ||
10 | server 127.127.1.0 | ||
11 | fudge 127.127.1.0 stratum 14 | ||
12 | # Defining a default security setting | ||
13 | restrict default nomodify nopeer | ||
diff --git a/meta-oe/recipes-support/ntp/files/hipox/ntpd b/meta-oe/recipes-support/ntp/files/hipox/ntpd new file mode 100755 index 000000000..7d2cd34cd --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/hipox/ntpd | |||
@@ -0,0 +1,62 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # ntpd init.d script for ntpdc from ntp.isc.org | ||
4 | test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 | ||
5 | # rcS contains TICKADJ | ||
6 | test -r /etc/default/rcS && . /etc/default/rcS | ||
7 | |||
8 | # Functions to do individual actions | ||
9 | settick(){ | ||
10 | # If TICKADJ is set we *must* adjust it before we start, because the | ||
11 | # driftfile relies on the correct setting | ||
12 | test -n "$TICKADJ" -a -x /usr/bin/tickadj && { | ||
13 | echo -n "Setting tick to $TICKADJ: " | ||
14 | /usr/bin/tickadj "$TICKADJ" | ||
15 | echo "done" | ||
16 | } | ||
17 | } | ||
18 | startdaemon(){ | ||
19 | # The -g option allows ntpd to step the time to correct it just | ||
20 | # once. The daemon will exit if the clock drifts too much after | ||
21 | # this. If ntpd seems to disappear after a while assume TICKADJ | ||
22 | # above is set to a totally incorrect value. | ||
23 | echo -n "Starting ntpd: " | ||
24 | start-stop-daemon --start -x /usr/bin/ntpd -- -p /var/run/ntp.pid "$@" | ||
25 | echo "done" | ||
26 | } | ||
27 | stopdaemon(){ | ||
28 | echo -n "Stopping ntpd: " | ||
29 | start-stop-daemon --stop -p /var/run/ntp.pid | ||
30 | echo "done" | ||
31 | } | ||
32 | |||
33 | case "$1" in | ||
34 | start) | ||
35 | settick | ||
36 | startdaemon -g -x | ||
37 | ;; | ||
38 | stop) | ||
39 | stopdaemon | ||
40 | ;; | ||
41 | force-reload) | ||
42 | stopdaemon | ||
43 | settick | ||
44 | startdaemon -g -x | ||
45 | ;; | ||
46 | restart) | ||
47 | # Don't reset the tick here | ||
48 | stopdaemon | ||
49 | startdaemon -g -x | ||
50 | ;; | ||
51 | reload) | ||
52 | # Must do this by hand, but don't do -g | ||
53 | stopdaemon | ||
54 | startdaemon -x | ||
55 | ;; | ||
56 | *) | ||
57 | echo "Usage: ntpd { start | stop | restart | reload }" >&2 | ||
58 | exit 1 | ||
59 | ;; | ||
60 | esac | ||
61 | |||
62 | exit 0 | ||
diff --git a/meta-oe/recipes-support/ntp/files/ntp b/meta-oe/recipes-support/ntp/files/ntp new file mode 100755 index 000000000..e91a52869 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntp | |||
@@ -0,0 +1,31 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | FLAGS="defaults 23" | ||
4 | |||
5 | test -f /usr/bin/ntpd || exit 0 | ||
6 | |||
7 | case "$1" in | ||
8 | start) | ||
9 | echo -n "Starting NTP server: ntpd" | ||
10 | start-stop-daemon --start --quiet --exec /usr/bin/ntpd | ||
11 | echo "." | ||
12 | ;; | ||
13 | stop) | ||
14 | echo -n "Stopping NTP server: ntpd" | ||
15 | start-stop-daemon --stop --quiet --exec /usr/bin/ntpd | ||
16 | echo "." | ||
17 | ;; | ||
18 | restart|force-reload) | ||
19 | echo -n "Restarting NTP server: ntpd... " | ||
20 | start-stop-daemon --stop --quiet --exec /usr/bin/ntpd | ||
21 | sleep 2 | ||
22 | start-stop-daemon --start --quiet --exec /usr/bin/ntpd | ||
23 | echo "done." | ||
24 | ;; | ||
25 | *) | ||
26 | echo "Usage: /etc/init.d/ntp {start|stop|restart|force-reload}" | ||
27 | exit 1 | ||
28 | ;; | ||
29 | esac | ||
30 | |||
31 | exit 0 | ||
diff --git a/meta-oe/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch b/meta-oe/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch new file mode 100644 index 000000000..cb1e2f734 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | --- a/include/ntp_syscall.h.orig 2009-05-19 16:44:55.048156467 -0400 | ||
2 | +++ b/include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400 | ||
3 | @@ -14,6 +14,14 @@ | ||
4 | # include <sys/timex.h> | ||
5 | #endif | ||
6 | |||
7 | +#if defined(ADJ_NANO) && !defined(MOD_NANO) | ||
8 | +#define MOD_NANO ADJ_NANO | ||
9 | +#endif | ||
10 | + | ||
11 | +#if defined(ADJ_TAI) && !defined(MOD_TAI) | ||
12 | +#define MOD_TAI ADJ_TAI | ||
13 | +#endif | ||
14 | + | ||
15 | #ifndef NTP_SYSCALLS_LIBC | ||
16 | #ifdef NTP_SYSCALLS_STD | ||
17 | # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) | ||
diff --git a/meta-oe/recipes-support/ntp/files/ntp.conf b/meta-oe/recipes-support/ntp/files/ntp.conf new file mode 100644 index 000000000..02a44b0d0 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntp.conf | |||
@@ -0,0 +1,13 @@ | |||
1 | # This is the most basic ntp configuration file | ||
2 | # The driftfile must remain in a place specific to this | ||
3 | # machine - it records the machine specific clock error | ||
4 | driftfile /etc/ntp.drift | ||
5 | # This obtains a random server which will be close | ||
6 | # (in IP terms) to the machine. Add other servers | ||
7 | # as required, or change this. | ||
8 | server pool.ntp.org | ||
9 | # Using local hardware clock as fallback | ||
10 | server 127.127.1.0 | ||
11 | fudge 127.127.1.0 stratum 14 | ||
12 | # Defining a default security setting | ||
13 | restrict default nomodify nopeer | ||
diff --git a/meta-oe/recipes-support/ntp/files/ntpd b/meta-oe/recipes-support/ntp/files/ntpd new file mode 100755 index 000000000..ae50f135d --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntpd | |||
@@ -0,0 +1,62 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # ntpd init.d script for ntpdc from ntp.isc.org | ||
4 | test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 | ||
5 | # rcS contains TICKADJ | ||
6 | test -r /etc/default/rcS && . /etc/default/rcS | ||
7 | |||
8 | # Functions to do individual actions | ||
9 | settick(){ | ||
10 | # If TICKADJ is set we *must* adjust it before we start, because the | ||
11 | # driftfile relies on the correct setting | ||
12 | test -n "$TICKADJ" -a -x /usr/bin/tickadj && { | ||
13 | echo -n "Setting tick to $TICKADJ: " | ||
14 | /usr/bin/tickadj "$TICKADJ" | ||
15 | echo "done" | ||
16 | } | ||
17 | } | ||
18 | startdaemon(){ | ||
19 | # The -g option allows ntpd to step the time to correct it just | ||
20 | # once. The daemon will exit if the clock drifts too much after | ||
21 | # this. If ntpd seems to disappear after a while assume TICKADJ | ||
22 | # above is set to a totally incorrect value. | ||
23 | echo -n "Starting ntpd: " | ||
24 | start-stop-daemon --start -x /usr/bin/ntpd -- -p /var/run/ntp.pid "$@" | ||
25 | echo "done" | ||
26 | } | ||
27 | stopdaemon(){ | ||
28 | echo -n "Stopping ntpd: " | ||
29 | start-stop-daemon --stop -p /var/run/ntp.pid | ||
30 | echo "done" | ||
31 | } | ||
32 | |||
33 | case "$1" in | ||
34 | start) | ||
35 | settick | ||
36 | startdaemon -g | ||
37 | ;; | ||
38 | stop) | ||
39 | stopdaemon | ||
40 | ;; | ||
41 | force-reload) | ||
42 | stopdaemon | ||
43 | settick | ||
44 | startdaemon -g | ||
45 | ;; | ||
46 | restart) | ||
47 | # Don't reset the tick here | ||
48 | stopdaemon | ||
49 | startdaemon -g | ||
50 | ;; | ||
51 | reload) | ||
52 | # Must do this by hand, but don't do -g | ||
53 | stopdaemon | ||
54 | startdaemon | ||
55 | ;; | ||
56 | *) | ||
57 | echo "Usage: ntpd { start | stop | restart | reload }" >&2 | ||
58 | exit 1 | ||
59 | ;; | ||
60 | esac | ||
61 | |||
62 | exit 0 | ||
diff --git a/meta-oe/recipes-support/ntp/files/ntpdate b/meta-oe/recipes-support/ntp/files/ntpdate new file mode 100755 index 000000000..784b029ad --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntpdate | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | PATH=/sbin:/bin:/usr/bin | ||
4 | |||
5 | test -x /usr/bin/ntpdate || exit 0 | ||
6 | |||
7 | if test -f /etc/default/ntpdate ; then | ||
8 | . /etc/default/ntpdate | ||
9 | else | ||
10 | NTPSERVERS="pool.ntp.org" | ||
11 | fi | ||
12 | |||
13 | test -n "$NTPSERVERS" || exit 0 | ||
14 | |||
15 | # This is a heuristic: The idea is that if a static interface is brought | ||
16 | # up, that is a major event, and we can put in some extra effort to fix | ||
17 | # the system time. Feel free to change this, especially if you regularly | ||
18 | # bring up new network interfaces. | ||
19 | if [ "$METHOD" = static ]; then | ||
20 | OPTS="-b" | ||
21 | fi | ||
22 | |||
23 | if [ "$METHOD" = loopback ]; then | ||
24 | exit 0 | ||
25 | fi | ||
26 | |||
27 | ( | ||
28 | |||
29 | LOCKFILE=/var/lock/ntpdate | ||
30 | |||
31 | # Avoid running more than one at a time | ||
32 | if [ -x /usr/bin/lockfile-create ]; then | ||
33 | lockfile-create $LOCKFILE | ||
34 | lockfile-touch $LOCKFILE & | ||
35 | LOCKTOUCHPID="$!" | ||
36 | fi | ||
37 | |||
38 | if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then | ||
39 | if [ "$UPDATE_HWCLOCK" = "yes" ]; then | ||
40 | hwclock --systohc || : | ||
41 | fi | ||
42 | fi | ||
43 | |||
44 | if [ -x /usr/bin/lockfile-create ] ; then | ||
45 | kill $LOCKTOUCHPID | ||
46 | lockfile-remove $LOCKFILE | ||
47 | fi | ||
48 | |||
49 | ) & | ||
diff --git a/meta-oe/recipes-support/ntp/files/tickadj.c.patch b/meta-oe/recipes-support/ntp/files/tickadj.c.patch new file mode 100644 index 000000000..9ef9de9e1 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/tickadj.c.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | Index: ntp-4.2.2p3-r0/ntp-4.2.2p3/util/tickadj.c | ||
2 | =================================================================== | ||
3 | --- ntp-4.2.2p3/util/tickadj.c 2004-02-25 06:58:33.000000000 +0100 | ||
4 | +++ ntp-4.2.2p3/util/tickadj.c 2007-07-07 01:00:54.000000000 +0200 | ||
5 | @@ -21,7 +21,8 @@ | ||
6 | # include <unistd.h> | ||
7 | #endif /* HAVE_UNISTD_H */ | ||
8 | |||
9 | -#ifdef HAVE___ADJTIMEX /* Linux */ | ||
10 | +/* proper handling here has been moved to upstream ntp bugzilla */ | ||
11 | +#ifdef linux | ||
12 | |||
13 | #include <sys/timex.h> | ||
14 | struct timex txc; | ||
15 | @@ -91,7 +92,7 @@ | ||
16 | } | ||
17 | |||
18 | if (!errflg) { | ||
19 | - if (__adjtimex(&txc) < 0) | ||
20 | + if (adjtimex(&txc) < 0) | ||
21 | perror("adjtimex"); | ||
22 | else if (!quiet) | ||
23 | printf("tick = %ld\ntick_adj = %d\n", | ||
24 | @@ -146,7 +147,7 @@ | ||
25 | #endif | ||
26 | } | ||
27 | |||
28 | - if (__adjtimex(&txc) < 0) | ||
29 | + if (adjtimex(&txc) < 0) | ||
30 | { | ||
31 | perror("adjtimex"); | ||
32 | } | ||
diff --git a/meta-oe/recipes-support/ntp/ntp-ssl_4.2.6p3.bb b/meta-oe/recipes-support/ntp/ntp-ssl_4.2.6p3.bb new file mode 100644 index 000000000..a15899079 --- /dev/null +++ b/meta-oe/recipes-support/ntp/ntp-ssl_4.2.6p3.bb | |||
@@ -0,0 +1,11 @@ | |||
1 | require ntp_${PV}.bb | ||
2 | DEPENDS = "openssl" | ||
3 | |||
4 | S = "${WORKDIR}/ntp-${PV}" | ||
5 | |||
6 | EXTRA_OECONF = "--with-openssl-libdir=${STAGING_LIBDIR} \ | ||
7 | --with-openssl-incdir=${STAGING_INCDIR}/openssl" | ||
8 | |||
9 | |||
10 | SRC_URI[md5sum] = "98e16c7aa4ecd4c004b51bff18962e95" | ||
11 | SRC_URI[sha256sum] = "9f4a5271a285d390c9225e3ea28f70049ea377d30fc6de4659007cfff278671a" | ||
diff --git a/meta-oe/recipes-support/ntp/ntp.inc b/meta-oe/recipes-support/ntp/ntp.inc new file mode 100644 index 000000000..c72e40e79 --- /dev/null +++ b/meta-oe/recipes-support/ntp/ntp.inc | |||
@@ -0,0 +1,33 @@ | |||
1 | DESCRIPTION = "The Network Time Protocol (NTP) is used to \ | ||
2 | synchronize the time of a computer client or server to \ | ||
3 | another server or reference time source, such as a radio \ | ||
4 | or satellite receiver or modem." | ||
5 | HOMEPAGE = "http://ntp.isc.org/bin/view/Main/WebHome" | ||
6 | SECTION = "console/network" | ||
7 | PRIORITY = "optional" | ||
8 | LICENSE = "ntp" | ||
9 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=fea4b50c33b18c2194b4b1c9ca512670" | ||
10 | RSUGGESTS_${PN} = "iana-etc" | ||
11 | |||
12 | SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${P}.tar.gz \ | ||
13 | file://ipv6only-workaround.patch \ | ||
14 | file://ntpd \ | ||
15 | file://ntp.conf \ | ||
16 | file://ntpdate" | ||
17 | |||
18 | inherit autotools update-rc.d | ||
19 | |||
20 | INITSCRIPT_NAME = "ntpd" | ||
21 | # No dependencies, so just go in at the standard level (20) | ||
22 | INITSCRIPT_PARAMS = "defaults" | ||
23 | |||
24 | # The ac_cv_header_readline_history is to stop ntpdc depending on either | ||
25 | # readline or curses | ||
26 | EXTRA_OECONF = "--without-openssl --without-crypto ac_cv_header_readline_history_h=no" | ||
27 | CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" | ||
28 | |||
29 | PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils" | ||
30 | # NOTE: you don't need ntpdate, use "ntpdc -q -g -x" | ||
31 | |||
32 | # This should use rc.update | ||
33 | FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/init.d/ntpdate" | ||
diff --git a/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb new file mode 100644 index 000000000..f64f6f6d9 --- /dev/null +++ b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb | |||
@@ -0,0 +1,46 @@ | |||
1 | require ntp.inc | ||
2 | |||
3 | PR = "r1" | ||
4 | |||
5 | SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${P}.tar.gz \ | ||
6 | file://tickadj.c.patch \ | ||
7 | file://ntp-4.2.4_p6-nano.patch \ | ||
8 | file://ntpd \ | ||
9 | file://ntp.conf \ | ||
10 | file://ntpdate" | ||
11 | |||
12 | SRC_URI[md5sum] = "59876a9009b098ff59767ee45a88ebd2" | ||
13 | SRC_URI[sha256sum] = "6e84d4ddfa14b911c3ed88463af10867e1fa9b287e7b34d8a02e78be85a7c40e" | ||
14 | |||
15 | EXTRA_OECONF += " --with-net-snmp-config=no --without-ntpsnmpd" | ||
16 | |||
17 | do_install_append() { | ||
18 | install -d ${D}/${sysconfdir}/init.d | ||
19 | install -m 644 ${WORKDIR}/ntp.conf ${D}/${sysconfdir} | ||
20 | install -m 755 ${WORKDIR}/ntpd ${D}/${sysconfdir}/init.d | ||
21 | install -d ${D}/${sysconfdir}/network/if-up.d | ||
22 | install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d | ||
23 | } | ||
24 | |||
25 | FILES_${PN}-bin = "${bindir}/ntp-wait ${bindir}/ntpdc ${bindir}/ntpq ${bindir}/ntptime ${bindir}/ntptrace" | ||
26 | FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd" | ||
27 | FILES_${PN}-tickadj = "${bindir}/tickadj" | ||
28 | FILES_ntp-utils = "${bindir}/*" | ||
29 | FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate" | ||
30 | |||
31 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms | ||
32 | # with wonky clocks (e.g. OpenSlug) | ||
33 | RDEPENDS_${PN} = "${PN}-tickadj" | ||
34 | |||
35 | pkg_postinst_ntpdate() { | ||
36 | if test "x$D" != "x"; then | ||
37 | exit 1 | ||
38 | else | ||
39 | if ! grep -q -s ntpdate /var/spool/cron/root; then | ||
40 | echo "adding crontab" | ||
41 | test -d /var/spool/cron || mkdir -p /var/spool/cron | ||
42 | echo "30 * * * * /usr/bin/ntpdate -b -s -u pool.ntp.org" >> /var/spool/cron/root | ||
43 | fi | ||
44 | fi | ||
45 | } | ||
46 | |||