Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | SUMMARY = "Rotates, compresses, removes and mails system log files" |
| 2 | SECTION = "console/utils" |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 3 | HOMEPAGE = "https://github.com/logrotate/logrotate/" |
| 4 | DESCRIPTION = "The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files." |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | LICENSE = "GPLv2" |
| 6 | |
| 7 | # TODO: Document coreutils dependency. Why not RDEPENDS? Why not busybox? |
| 8 | |
| 9 | DEPENDS="coreutils popt" |
| 10 | |
| 11 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 12 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases" |
| 14 | UPSTREAM_CHECK_REGEX = "logrotate-(?P<pver>\d+(\.\d+)+).tar" |
| 15 | |
| 16 | SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BP}.tar.xz \ |
| 17 | file://act-as-mv-when-rotate.patch \ |
Andrew Geissler | 4b740dc | 2020-05-05 08:54:39 -0500 | [diff] [blame] | 18 | file://0001-Update-the-manual.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 19 | file://disable-check-different-filesystems.patch \ |
| 20 | " |
| 21 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 22 | SRC_URI[sha256sum] = "14a924e4804b3974e85019a9f9352c2a69726702e6656155c48bcdeace68a5dc" |
| 23 | |
| 24 | # These CVEs are debian, gentoo or SUSE specific on the way logrotate was installed/used |
| 25 | CVE_CHECK_WHITELIST += "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 26 | |
| 27 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" |
| 28 | |
| 29 | PACKAGECONFIG[acl] = ",,acl" |
| 30 | PACKAGECONFIG[selinux] = ",,libselinux" |
| 31 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | CONFFILES:${PN} += "${localstatedir}/lib/logrotate.status \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 33 | ${sysconfdir}/logrotate.conf \ |
| 34 | ${sysconfdir}/logrotate.d/btmp \ |
| 35 | ${sysconfdir}/logrotate.d/wtmp" |
| 36 | |
| 37 | # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our |
| 38 | # optimization variables, so use it rather than EXTRA_CFLAGS. |
| 39 | EXTRA_OEMAKE = "\ |
| 40 | LFS= \ |
| 41 | OS_NAME='${OS_NAME}' \ |
| 42 | 'CC=${CC}' \ |
| 43 | 'RPM_OPT_FLAGS=${CFLAGS}' \ |
| 44 | 'EXTRA_LDFLAGS=${LDFLAGS}' \ |
| 45 | ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ |
| 46 | ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ |
| 47 | " |
| 48 | |
| 49 | # OS_NAME in the makefile defaults to `uname -s`. The behavior for |
| 50 | # freebsd/netbsd is questionable, so leave it as Linux, which only sets |
| 51 | # INSTALL=install and BASEDIR=/usr. |
| 52 | OS_NAME = "Linux" |
| 53 | |
| 54 | inherit autotools systemd |
| 55 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 56 | SYSTEMD_SERVICE:${PN} = "\ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 57 | ${BPN}.service \ |
| 58 | ${BPN}.timer \ |
| 59 | " |
| 60 | |
| 61 | LOGROTATE_OPTIONS ?= "" |
| 62 | |
| 63 | LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" |
| 64 | LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" |
| 65 | LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" |
| 66 | |
| 67 | do_install(){ |
| 68 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} |
| 69 | mkdir -p ${D}${sysconfdir}/logrotate.d |
| 70 | mkdir -p ${D}${localstatedir}/lib |
| 71 | install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf |
| 72 | install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp |
| 73 | install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp |
| 74 | touch ${D}${localstatedir}/lib/logrotate.status |
| 75 | |
| 76 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 77 | install -d ${D}${systemd_system_unitdir} |
| 78 | install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service |
| 79 | install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer |
| 80 | [ -z "${LOGROTATE_OPTIONS}" ] || |
| 81 | sed -ri \ |
| 82 | -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ |
| 83 | ${D}${systemd_system_unitdir}/logrotate.service |
| 84 | sed -ri \ |
| 85 | -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ |
| 86 | -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ |
| 87 | -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ |
| 88 | ${D}${systemd_system_unitdir}/logrotate.timer |
| 89 | fi |
| 90 | |
| 91 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 92 | mkdir -p ${D}${sysconfdir}/cron.daily |
| 93 | install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate |
| 94 | fi |
| 95 | } |