diff options
Diffstat (limited to 'meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb')
-rw-r--r-- | meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb new file mode 100644 index 000000000..693bdbbf0 --- /dev/null +++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb | |||
@@ -0,0 +1,155 @@ | |||
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=f41fedb22dffefcbfafecc85b0f79cfa" | ||
10 | |||
11 | DEPENDS = "pps-tools 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://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 | |||
26 | SRC_URI[md5sum] = "fa37049383316322d060ec9061ac23a9" | ||
27 | SRC_URI[sha256sum] = "0d69bc0e95caad43ea04fdad410e756bae1a71e67b1c2bd799b76b55e04c9b31" | ||
28 | |||
29 | inherit 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 | ||
33 | EXTRA_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 | " | ||
39 | CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" | ||
40 | |||
41 | USERADD_PACKAGES = "${PN}" | ||
42 | NTP_USER_HOME ?= "/var/lib/ntp" | ||
43 | USERADD_PARAM_${PN} = "--system --home-dir ${NTP_USER_HOME} \ | ||
44 | --no-create-home \ | ||
45 | --shell /bin/false --user-group ntp" | ||
46 | |||
47 | # NB: debug is default-enabled by NTP; keep it default-enabled here. | ||
48 | PACKAGECONFIG ??= "cap debug" | ||
49 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ | ||
50 | --with-openssl-incdir=${STAGING_INCDIR} \ | ||
51 | --with-crypto, \ | ||
52 | --without-openssl --without-crypto, \ | ||
53 | openssl" | ||
54 | PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" | ||
55 | PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" | ||
56 | PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" | ||
57 | |||
58 | do_install_append() { | ||
59 | install -d ${D}${sysconfdir}/init.d | ||
60 | install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} | ||
61 | install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d | ||
62 | install -d ${D}${bindir} | ||
63 | install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync | ||
64 | |||
65 | install -m 755 -d ${D}${NTP_USER_HOME} | ||
66 | chown ntp:ntp ${D}${NTP_USER_HOME} | ||
67 | |||
68 | # Fix hardcoded paths in scripts | ||
69 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
70 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
71 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
72 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync | ||
73 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync | ||
74 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace | ||
75 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace | ||
76 | sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait | ||
77 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait | ||
78 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj | ||
79 | sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj | ||
80 | |||
81 | install -d ${D}/${sysconfdir}/default | ||
82 | install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate | ||
83 | install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/ | ||
84 | |||
85 | install -d ${D}/${sysconfdir}/network/if-up.d | ||
86 | ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d | ||
87 | |||
88 | install -d ${D}${systemd_unitdir}/system | ||
89 | install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/ | ||
90 | install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/ | ||
91 | install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/ | ||
92 | |||
93 | install -d ${D}${systemd_unitdir}/ntp-units.d | ||
94 | install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list | ||
95 | } | ||
96 | |||
97 | PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils" | ||
98 | # NOTE: you don't need ntpdate, use "ntpd -q -g -x" | ||
99 | |||
100 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms | ||
101 | # with wonky clocks (e.g. OpenSlug) | ||
102 | RDEPENDS_${PN} = "${PN}-tickadj" | ||
103 | # Handle move from bin to utils package | ||
104 | RPROVIDES_${PN}-utils = "${PN}-bin" | ||
105 | RREPLACES_${PN}-utils = "${PN}-bin" | ||
106 | RCONFLICTS_${PN}-utils = "${PN}-bin" | ||
107 | |||
108 | SYSTEMD_PACKAGES = "${PN} ntpdate sntp" | ||
109 | SYSTEMD_SERVICE_${PN} = "ntpd.service" | ||
110 | SYSTEMD_SERVICE_ntpdate = "ntpdate.service" | ||
111 | SYSTEMD_SERVICE_sntp = "sntp.service" | ||
112 | |||
113 | RPROVIDES_${PN} += "${PN}-systemd" | ||
114 | RREPLACES_${PN} += "${PN}-systemd" | ||
115 | RCONFLICTS_${PN} += "${PN}-systemd" | ||
116 | |||
117 | RPROVIDES_ntpdate += "ntpdate-systemd" | ||
118 | RREPLACES_ntpdate += "ntpdate-systemd" | ||
119 | RCONFLICTS_ntpdate += "ntpdate-systemd" | ||
120 | |||
121 | RSUGGESTS_${PN} = "iana-etc" | ||
122 | |||
123 | FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \ | ||
124 | ${NTP_USER_HOME} \ | ||
125 | ${systemd_unitdir}/ntp-units.d/60-ntpd.list \ | ||
126 | " | ||
127 | FILES_${PN}-tickadj = "${sbindir}/tickadj" | ||
128 | FILES_${PN}-utils = "${sbindir} ${datadir}/ntp/lib" | ||
129 | RDEPENDS_${PN}-utils += "perl" | ||
130 | FILES_ntpdate = "${sbindir}/ntpdate \ | ||
131 | ${sysconfdir}/network/if-up.d/ntpdate-sync \ | ||
132 | ${bindir}/ntpdate-sync \ | ||
133 | ${sysconfdir}/default/ntpdate \ | ||
134 | ${systemd_unitdir}/system/ntpdate.service \ | ||
135 | " | ||
136 | FILES_sntp = "${sbindir}/sntp \ | ||
137 | ${sysconfdir}/default/sntp \ | ||
138 | ${systemd_unitdir}/system/sntp.service \ | ||
139 | " | ||
140 | |||
141 | CONFFILES_${PN} = "${sysconfdir}/ntp.conf" | ||
142 | CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate" | ||
143 | |||
144 | INITSCRIPT_NAME = "ntpd" | ||
145 | # No dependencies, so just go in at the standard level (20) | ||
146 | INITSCRIPT_PARAMS = "defaults" | ||
147 | |||
148 | pkg_postinst_ntpdate() { | ||
149 | if ! grep -q -s ntpdate $D/var/spool/cron/root; then | ||
150 | echo "adding crontab" | ||
151 | test -d $D/var/spool/cron || mkdir -p $D/var/spool/cron | ||
152 | echo "30 * * * * ${bindir}/ntpdate-sync silent" >> $D/var/spool/cron/root | ||
153 | fi | ||
154 | } | ||
155 | |||