xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/sysstat/sysstat.inc (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "System performance tools"
2DESCRIPTION = "The sysstat utilities are a collection of performance monitoring tools for Linux."
3HOMEPAGE = "http://sebastien.godard.pagesperso-orange.fr/"
4LICENSE = "GPL-2.0-or-later"
5SECTION = "console/utils"
6
7SRC_URI = "http://pagesperso-orange.fr/sebastien.godard/${BP}.tar.xz \
8           file://99_sysstat \
9           file://sysstat.service \
10          "
11
12UPSTREAM_CHECK_URI = "http://sebastien.godard.pagesperso-orange.fr/download.html"
13
14DEPENDS += "base-passwd"
15
16# autotools-brokensep as this package doesn't use automake
17inherit autotools-brokensep gettext systemd upstream-version-is-even
18
19PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
20PACKAGECONFIG[lm-sensors] = "--enable-sensors,--disable-sensors,lmsensors,lmsensors-libsensors"
21PACKAGECONFIG[cron] = "--enable-install-cron --enable-copy-only,--disable-install-cron --disable-copy-only"
22PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}"
23
24EXTRA_OECONF += "--disable-stripping"
25
26SYSTEMD_PACKAGES = "${PN}"
27SYSTEMD_SERVICE:${PN} = "sysstat.service"
28SYSTEMD_AUTO_ENABLE = "enable"
29
30do_configure:prepend() {
31    export sa_lib_dir=${libexecdir}/sa
32}
33
34do_install() {
35	autotools_do_install
36
37	# Don't version the documentation
38	mv ${D}${docdir}/${BP} ${D}${docdir}/${BPN}
39
40	# don't install /var/log/sa when populating rootfs. Do it through volatile
41	rm -rf ${D}/var
42	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
43	        install -d ${D}/etc/default/volatiles
44		install -m 0644 ${WORKDIR}/99_sysstat ${D}/etc/default/volatiles
45	fi
46	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
47	        install -d ${D}${sysconfdir}/tmpfiles.d
48	        echo "d ${localstatedir}/log/sa - - - -" \
49		     > ${D}${sysconfdir}/tmpfiles.d/sysstat.conf
50
51		# Unless both cron and systemd are enabled, install our own
52		# systemd unit file. Otherwise the package will install one.
53	        if ${@bb.utils.contains('PACKAGECONFIG', 'cron systemd', 'false', 'true', d)}; then
54			install -d ${D}${systemd_system_unitdir}
55			install -m 0644 ${WORKDIR}/sysstat.service ${D}${systemd_system_unitdir}
56			sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_system_unitdir}/sysstat.service
57	        fi
58	fi
59}
60
61pkg_postinst:${PN} () {
62	if [  ! -n "$D" ]; then
63		if [ -e /etc/init.d/populate-volatile.sh ]; then
64			/etc/init.d/populate-volatile.sh update
65		fi
66	fi
67}
68
69FILES:${PN} += "${systemd_system_unitdir} ${nonarch_base_libdir}/systemd"
70
71TARGET_CC_ARCH += "${LDFLAGS}"
72