diff options
Diffstat (limited to 'meta/recipes-support/ntp/ntp.inc')
-rw-r--r-- | meta/recipes-support/ntp/ntp.inc | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-support/ntp/ntp.inc b/meta/recipes-support/ntp/ntp.inc new file mode 100644 index 0000000000..d93f22d473 --- /dev/null +++ b/meta/recipes-support/ntp/ntp.inc | |||
@@ -0,0 +1,93 @@ | |||
1 | SUMMARY = "Network Time Protocol daemon and utilities" | ||
2 | DESCRIPTION = "The Network Time Protocol (NTP) is used to \ | ||
3 | synchronize the time of a computer client or server to \ | ||
4 | another server or reference time source, such as a radio \ | ||
5 | or satellite receiver or modem." | ||
6 | HOMEPAGE = "http://support.ntp.org" | ||
7 | SECTION = "console/network" | ||
8 | LICENSE = "NTP" | ||
9 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=fea4b50c33b18c2194b4b1c9ca512670" | ||
10 | |||
11 | INC_PR = "r3" | ||
12 | |||
13 | SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.gz \ | ||
14 | file://tickadj.c.patch \ | ||
15 | file://ntp-4.2.4_p6-nano.patch \ | ||
16 | file://openssl-check.patch \ | ||
17 | file://ntpd \ | ||
18 | file://ntp.conf \ | ||
19 | file://ntpdate \ | ||
20 | file://ntpdate.default \ | ||
21 | " | ||
22 | |||
23 | inherit autotools update-rc.d | ||
24 | |||
25 | # The ac_cv_header_readline_history is to stop ntpdc depending on either | ||
26 | # readline or curses | ||
27 | EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no" | ||
28 | CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" | ||
29 | |||
30 | PACKAGECONFIG ??= "" | ||
31 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ | ||
32 | --with-openssl-incdir=${STAGING_INCDIR} \ | ||
33 | --with-crypto, \ | ||
34 | --without-openssl --without-crypto, \ | ||
35 | openssl" | ||
36 | |||
37 | do_install_append() { | ||
38 | install -d ${D}${sysconfdir}/init.d | ||
39 | install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} | ||
40 | install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d | ||
41 | install -d ${D}${bindir} | ||
42 | install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync | ||
43 | |||
44 | # Fix hardcoded paths in scripts | ||
45 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
46 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
47 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
48 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
49 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync | ||
50 | |||
51 | install -d ${D}/${sysconfdir}/default | ||
52 | install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate | ||
53 | install -d ${D}/${sysconfdir}/network/if-up.d | ||
54 | ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d | ||
55 | } | ||
56 | |||
57 | PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils" | ||
58 | # NOTE: you don't need ntpdate, use "ntpd -q -g -x" | ||
59 | |||
60 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms | ||
61 | # with wonky clocks (e.g. OpenSlug) | ||
62 | RDEPENDS_${PN} = "${PN}-tickadj" | ||
63 | # Handle move from bin to utils package | ||
64 | RPROVIDES_${PN}-utils = "${PN}-bin" | ||
65 | RREPLACES_${PN}-utils = "${PN}-bin" | ||
66 | RCONFLICTS_${PN}-utils = "${PN}-bin" | ||
67 | |||
68 | RSUGGESTS_${PN} = "iana-etc" | ||
69 | |||
70 | FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}" | ||
71 | FILES_${PN}-tickadj = "${bindir}/tickadj" | ||
72 | FILES_${PN}-utils = "${bindir}" | ||
73 | FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate-sync ${bindir}/ntpdate-sync ${sysconfdir}/default/ntpdate" | ||
74 | |||
75 | CONFFILES_${PN} = "${sysconfdir}/ntp.conf" | ||
76 | CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate" | ||
77 | |||
78 | INITSCRIPT_NAME = "ntpd" | ||
79 | # No dependencies, so just go in at the standard level (20) | ||
80 | INITSCRIPT_PARAMS = "defaults" | ||
81 | |||
82 | pkg_postinst_ntpdate() { | ||
83 | if test "x$D" != "x"; then | ||
84 | exit 1 | ||
85 | else | ||
86 | if ! grep -q -s ntpdate /var/spool/cron/root; then | ||
87 | echo "adding crontab" | ||
88 | test -d /var/spool/cron || mkdir -p /var/spool/cron | ||
89 | echo "30 * * * * ${bindir}/ntpdate-sync silent" >> /var/spool/cron/root | ||
90 | fi | ||
91 | fi | ||
92 | } | ||
93 | |||