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