summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/ntp/ntp.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/ntp/ntp.inc')
-rw-r--r--meta/recipes-support/ntp/ntp.inc93
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 @@
1SUMMARY = "Network Time Protocol daemon and utilities"
2DESCRIPTION = "The Network Time Protocol (NTP) is used to \
3synchronize the time of a computer client or server to \
4another server or reference time source, such as a radio \
5or satellite receiver or modem."
6HOMEPAGE = "http://support.ntp.org"
7SECTION = "console/network"
8LICENSE = "NTP"
9LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=fea4b50c33b18c2194b4b1c9ca512670"
10
11INC_PR = "r3"
12
13SRC_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
23inherit autotools update-rc.d
24
25# The ac_cv_header_readline_history is to stop ntpdc depending on either
26# readline or curses
27EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no"
28CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"
29
30PACKAGECONFIG ??= ""
31PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \
32 --with-openssl-incdir=${STAGING_INCDIR} \
33 --with-crypto, \
34 --without-openssl --without-crypto, \
35 openssl"
36
37do_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
57PACKAGES += "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)
62RDEPENDS_${PN} = "${PN}-tickadj"
63# Handle move from bin to utils package
64RPROVIDES_${PN}-utils = "${PN}-bin"
65RREPLACES_${PN}-utils = "${PN}-bin"
66RCONFLICTS_${PN}-utils = "${PN}-bin"
67
68RSUGGESTS_${PN} = "iana-etc"
69
70FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}"
71FILES_${PN}-tickadj = "${bindir}/tickadj"
72FILES_${PN}-utils = "${bindir}"
73FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate-sync ${bindir}/ntpdate-sync ${sysconfdir}/default/ntpdate"
74
75CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
76CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
77
78INITSCRIPT_NAME = "ntpd"
79# No dependencies, so just go in at the standard level (20)
80INITSCRIPT_PARAMS = "defaults"
81
82pkg_postinst_ntpdate() {
83if test "x$D" != "x"; then
84 exit 1
85else
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
91fi
92}
93