summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support/ntp/ntp.inc
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-10 03:20:04 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-10 03:20:04 +0200
commit1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch)
tree0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-support/ntp/ntp.inc
downloadmeta-openembedded-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-support/ntp/ntp.inc')
-rw-r--r--meta-networking/recipes-support/ntp/ntp.inc137
1 files changed, 137 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/ntp/ntp.inc b/meta-networking/recipes-support/ntp/ntp.inc
new file mode 100644
index 0000000000..49f9901e1e
--- /dev/null
+++ b/meta-networking/recipes-support/ntp/ntp.inc
@@ -0,0 +1,137 @@
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 = "r6"
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 file://ntpdate.service \
22 file://ntpd.service \
23 file://sntp.service \
24 file://sntp \
25 file://ntpd.list \
26"
27
28inherit autotools update-rc.d useradd systemd
29
30# The ac_cv_header_readline_history is to stop ntpdc depending on either
31# readline or curses
32EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no --with-binsubdir=sbin"
33CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"
34
35USERADD_PACKAGES = "${PN}"
36USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ntp \
37 --shell /bin/false --user-group ntp"
38
39PACKAGECONFIG ??= "cap"
40PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \
41 --with-openssl-incdir=${STAGING_INCDIR} \
42 --with-crypto, \
43 --without-openssl --without-crypto, \
44 openssl"
45PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap"
46PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline"
47
48do_install_append() {
49 install -d ${D}${sysconfdir}/init.d
50 install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir}
51 install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d
52 install -d ${D}${bindir}
53 install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
54
55 # Fix hardcoded paths in scripts
56 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
57 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
58 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
59 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
60 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync
61 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace
62 sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace
63 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait
64 sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait
65
66 install -d ${D}/${sysconfdir}/default
67 install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate
68 install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/
69
70 install -d ${D}/${sysconfdir}/network/if-up.d
71 ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d
72
73 install -d ${D}${systemd_unitdir}/system
74 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/
75 install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/
76 install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/
77
78 install -d ${D}${systemd_unitdir}/ntp-units.d
79 install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list
80}
81
82PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
83# NOTE: you don't need ntpdate, use "ntpd -q -g -x"
84
85# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms
86# with wonky clocks (e.g. OpenSlug)
87RDEPENDS_${PN} = "${PN}-tickadj"
88# Handle move from bin to utils package
89RPROVIDES_${PN}-utils = "${PN}-bin"
90RREPLACES_${PN}-utils = "${PN}-bin"
91RCONFLICTS_${PN}-utils = "${PN}-bin"
92
93SYSTEMD_PACKAGES = "${PN} ntpdate sntp"
94SYSTEMD_SERVICE_${PN} = "ntpd.service"
95SYSTEMD_SERVICE_ntpdate = "ntpdate.service"
96SYSTEMD_SERVICE_sntp = "sntp.service"
97
98RPROVIDES_${PN} += "${PN}-systemd"
99RREPLACES_${PN} += "${PN}-systemd"
100RCONFLICTS_${PN} += "${PN}-systemd"
101
102RPROVIDES_ntpdate += "ntpdate-systemd"
103RREPLACES_ntpdate += "ntpdate-systemd"
104RCONFLICTS_ntpdate += "ntpdate-systemd"
105
106RSUGGESTS_${PN} = "iana-etc"
107
108FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
109 ${systemd_unitdir}/ntp-units.d/60-ntpd.list \
110"
111FILES_${PN}-tickadj = "${sbindir}/tickadj"
112FILES_${PN}-utils = "${sbindir}"
113FILES_ntpdate = "${sbindir}/ntpdate \
114 ${sysconfdir}/network/if-up.d/ntpdate-sync \
115 ${bindir}/ntpdate-sync \
116 ${sysconfdir}/default/ntpdate \
117 ${systemd_unitdir}/system/ntpdate.service \
118"
119FILES_sntp = "${sbindir}/sntp \
120 ${sysconfdir}/default/sntp \
121 "
122
123CONFFILES_${PN} = "${sysconfdir}/ntp.conf"
124CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate"
125
126INITSCRIPT_NAME = "ntpd"
127# No dependencies, so just go in at the standard level (20)
128INITSCRIPT_PARAMS = "defaults"
129
130pkg_postinst_ntpdate() {
131 if ! grep -q -s ntpdate $D/var/spool/cron/root; then
132 echo "adding crontab"
133 test -d $D/var/spool/cron || mkdir -p $D/var/spool/cron
134 echo "30 * * * * ${bindir}/ntpdate-sync silent" >> $D/var/spool/cron/root
135 fi
136}
137