diff options
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.bb | 178 |
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 @@ | |||
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 = "net" | ||
8 | LICENSE = "NTP" | ||
9 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4cee33257467509e498f4cd9a6a4bd53" | ||
10 | |||
11 | DEPENDS = "libevent" | ||
12 | |||
13 | SRC_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 | |||
28 | SRC_URI[md5sum] = "ea040ab9b4ca656b5229b89d6b822f13" | ||
29 | SRC_URI[sha256sum] = "288772cecfcd9a53694ffab108d1825a31ba77f3a8466b0401baeca3bc232a38" | ||
30 | |||
31 | inherit 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 | ||
35 | EXTRA_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 | " | ||
42 | CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" | ||
43 | |||
44 | USERADD_PACKAGES = "${PN}" | ||
45 | NTP_USER_HOME ?= "/var/lib/ntp" | ||
46 | USERADD_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. | ||
51 | PACKAGECONFIG ??= "cap debug refclocks openssl \ | ||
52 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ | ||
53 | " | ||
54 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ | ||
55 | --with-openssl-incdir=${STAGING_INCDIR} \ | ||
56 | --with-crypto, \ | ||
57 | --without-openssl --without-crypto, \ | ||
58 | openssl" | ||
59 | PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" | ||
60 | PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" | ||
61 | PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools" | ||
62 | PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" | ||
63 | PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns" | ||
64 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," | ||
65 | |||
66 | do_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 | |||
108 | PACKAGES += "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) | ||
113 | RDEPENDS_${PN} = "${PN}-tickadj" | ||
114 | # ntpd require libgcc for execution | ||
115 | RDEPENDS_${PN} += "libgcc" | ||
116 | # Handle move from bin to utils package | ||
117 | RPROVIDES_${PN}-utils = "${PN}-bin" | ||
118 | RREPLACES_${PN}-utils = "${PN}-bin" | ||
119 | RCONFLICTS_${PN}-utils = "${PN}-bin" | ||
120 | # ntpq was split out of ntp-utils | ||
121 | RDEPENDS_${PN}-utils = "ntpq" | ||
122 | |||
123 | SYSTEMD_PACKAGES = "${PN} ntpdate sntp" | ||
124 | SYSTEMD_SERVICE_${PN} = "ntpd.service" | ||
125 | SYSTEMD_SERVICE_ntpdate = "ntpdate.service" | ||
126 | SYSTEMD_SERVICE_sntp = "sntp.service" | ||
127 | SYSTEMD_AUTO_ENABLE_sntp = "disable" | ||
128 | |||
129 | RPROVIDES_${PN} += "${PN}-systemd" | ||
130 | RREPLACES_${PN} += "${PN}-systemd" | ||
131 | RCONFLICTS_${PN} += "${PN}-systemd" | ||
132 | |||
133 | RPROVIDES_ntpdate += "ntpdate-systemd" | ||
134 | RREPLACES_ntpdate += "ntpdate-systemd" | ||
135 | RCONFLICTS_ntpdate += "ntpdate-systemd" | ||
136 | |||
137 | RSUGGESTS_${PN} = "iana-etc" | ||
138 | |||
139 | FILES_${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 | " | ||
143 | FILES_${PN}-tickadj = "${sbindir}/tickadj" | ||
144 | FILES_${PN}-utils = "${sbindir} ${datadir}/ntp/lib" | ||
145 | RDEPENDS_${PN}-utils += "perl" | ||
146 | FILES_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 | " | ||
152 | FILES_sntp = "${sbindir}/sntp \ | ||
153 | ${sysconfdir}/default/sntp \ | ||
154 | ${systemd_unitdir}/system/sntp.service \ | ||
155 | " | ||
156 | FILES_ntpq = "${sbindir}/ntpq" | ||
157 | |||
158 | CONFFILES_${PN} = "${sysconfdir}/ntp.conf" | ||
159 | CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate" | ||
160 | |||
161 | INITSCRIPT_NAME = "ntpd" | ||
162 | # No dependencies, so just go in at the standard level (20) | ||
163 | INITSCRIPT_PARAMS = "defaults" | ||
164 | |||
165 | pkg_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 | |||
173 | inherit update-alternatives | ||
174 | |||
175 | ALTERNATIVE_PRIORITY = "100" | ||
176 | |||
177 | ALTERNATIVE_${PN} = "ntpd" | ||
178 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" | ||