summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb')
-rw-r--r--meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb158
1 files changed, 158 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb
new file mode 100644
index 000000000..8055b5a25
--- /dev/null
+++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb
@@ -0,0 +1,158 @@
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 = "net"
8LICENSE = "NTP"
9LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=f41fedb22dffefcbfafecc85b0f79cfa"
10
11DEPENDS = "libevent"
12
13SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.gz \
14 file://ntp-4.2.4_p6-nano.patch \
15 file://ntpd \
16 file://ntp.conf \
17 file://ntpdate \
18 file://ntpdate.default \
19 file://ntpdate.service \
20 file://ntpd.service \
21 file://sntp.service \
22 file://sntp \
23 file://ntpd.list \
24"
25
26SRC_URI[md5sum] = "4a8636260435b230636f053ffd070e34"
27SRC_URI[sha256sum] = "2ab3d0b5f0456e6311dda1cc27ab75da108762773a19e46abd938bd9407b97ee"
28
29inherit autotools update-rc.d useradd systemd pkgconfig
30
31# The ac_cv_header_readline_history is to stop ntpdc depending on either
32# readline or curses
33EXTRA_OECONF += "--with-net-snmp-config=no \
34 --without-ntpsnmpd \
35 ac_cv_header_readline_history_h=no \
36 --with-yielding_select=yes \
37 --with-locfile=redhat \
38 --without-rpath \
39 "
40CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"
41
42USERADD_PACKAGES = "${PN}"
43NTP_USER_HOME ?= "/var/lib/ntp"
44USERADD_PARAM_${PN} = "--system --home-dir ${NTP_USER_HOME} \
45 --no-create-home \
46 --shell /bin/false --user-group ntp"
47
48# NB: debug is default-enabled by NTP; keep it default-enabled here.
49PACKAGECONFIG ??= "cap debug refclocks"
50PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \
51 --with-openssl-incdir=${STAGING_INCDIR} \
52 --with-crypto, \
53 --without-openssl --without-crypto, \
54 openssl"
55PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap"
56PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline"
57PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools"
58PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging"
59PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns"
60
61do_install_append() {
62 install -d ${D}${sysconfdir}/init.d
63 install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir}
64 install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d
65 install -d ${D}${bindir}
66 install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
67
68 install -m 755 -d ${D}${NTP_USER_HOME}
69 chown ntp:ntp ${D}${NTP_USER_HOME}
70
71 # Fix hardcoded paths in scripts
72 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
73 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
74 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
75 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
76 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync
77 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace
78 sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace
79 sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait
80 sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait
81 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj
82 sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj
83
84 install -d ${D}/${sysconfdir}/default
85 install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate
86 install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/
87
88 install -d ${D}/${sysconfdir}/network/if-up.d
89 ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d
90
91 install -d ${D}${systemd_unitdir}/system
92 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/
93 install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/
94 install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/
95
96 install -d ${D}${systemd_unitdir}/ntp-units.d
97 install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list
98}
99
100PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
101# NOTE: you don't need ntpdate, use "ntpd -q -g -x"
102
103# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms
104# with wonky clocks (e.g. OpenSlug)
105RDEPENDS_${PN} = "${PN}-tickadj"
106# Handle move from bin to utils package
107RPROVIDES_${PN}-utils = "${PN}-bin"
108RREPLACES_${PN}-utils = "${PN}-bin"
109RCONFLICTS_${PN}-utils = "${PN}-bin"
110
111SYSTEMD_PACKAGES = "${PN} ntpdate sntp"
112SYSTEMD_SERVICE_${PN} = "ntpd.service"
113SYSTEMD_SERVICE_ntpdate = "ntpdate.service"
114SYSTEMD_SERVICE_sntp = "sntp.service"
115
116RPROVIDES_${PN} += "${PN}-systemd"
117RREPLACES_${PN} += "${PN}-systemd"
118RCONFLICTS_${PN} += "${PN}-systemd"
119
120RPROVIDES_ntpdate += "ntpdate-systemd"
121RREPLACES_ntpdate += "ntpdate-systemd"
122RCONFLICTS_ntpdate += "ntpdate-systemd"
123
124RSUGGESTS_${PN} = "iana-etc"
125
126FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
127 ${NTP_USER_HOME} \
128 ${systemd_unitdir}/ntp-units.d/60-ntpd.list ${libexecdir}\
129"
130FILES_${PN}-tickadj = "${sbindir}/tickadj"
131FILES_${PN}-utils = "${sbindir} ${datadir}/ntp/lib"
132RDEPENDS_${PN}-utils += "perl"
133FILES_ntpdate = "${sbindir}/ntpdate \
134 ${sysconfdir}/network/if-up.d/ntpdate-sync \
135 ${bindir}/ntpdate-sync \
136 ${sysconfdir}/default/ntpdate \
137 ${systemd_unitdir}/system/ntpdate.service \
138"
139FILES_sntp = "${sbindir}/sntp \
140 ${sysconfdir}/default/sntp \
141 ${systemd_unitdir}/system/sntp.service \
142 "
143
144CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
145CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
146
147INITSCRIPT_NAME = "ntpd"
148# No dependencies, so just go in at the standard level (20)
149INITSCRIPT_PARAMS = "defaults"
150
151pkg_postinst_ntpdate() {
152 if ! grep -q -s ntpdate $D/var/spool/cron/root; then
153 echo "adding crontab"
154 test -d $D/var/spool/cron || mkdir -p $D/var/spool/cron
155 echo "30 * * * * ${bindir}/ntpdate-sync silent" >> $D/var/spool/cron/root
156 fi
157}
158