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 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 22 | SRC_URI[sha256sum] = "841f81bf09d0014e4a2e11af166bb33fcd8429cc0c2d4a7d3d9ceb3858cfccc5" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 23 | |
| 24 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" |
| 25 | |
| 26 | PACKAGECONFIG[acl] = ",,acl" |
| 27 | PACKAGECONFIG[selinux] = ",,libselinux" |
| 28 | |
| 29 | CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \ |
| 30 | ${sysconfdir}/logrotate.conf \ |
| 31 | ${sysconfdir}/logrotate.d/btmp \ |
| 32 | ${sysconfdir}/logrotate.d/wtmp" |
| 33 | |
| 34 | # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our |
| 35 | # optimization variables, so use it rather than EXTRA_CFLAGS. |
| 36 | EXTRA_OEMAKE = "\ |
| 37 | LFS= \ |
| 38 | OS_NAME='${OS_NAME}' \ |
| 39 | 'CC=${CC}' \ |
| 40 | 'RPM_OPT_FLAGS=${CFLAGS}' \ |
| 41 | 'EXTRA_LDFLAGS=${LDFLAGS}' \ |
| 42 | ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ |
| 43 | ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ |
| 44 | " |
| 45 | |
| 46 | # OS_NAME in the makefile defaults to `uname -s`. The behavior for |
| 47 | # freebsd/netbsd is questionable, so leave it as Linux, which only sets |
| 48 | # INSTALL=install and BASEDIR=/usr. |
| 49 | OS_NAME = "Linux" |
| 50 | |
| 51 | inherit autotools systemd |
| 52 | |
| 53 | SYSTEMD_SERVICE_${PN} = "\ |
| 54 | ${BPN}.service \ |
| 55 | ${BPN}.timer \ |
| 56 | " |
| 57 | |
| 58 | LOGROTATE_OPTIONS ?= "" |
| 59 | |
| 60 | LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" |
| 61 | LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" |
| 62 | LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" |
| 63 | |
| 64 | do_install(){ |
| 65 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} |
| 66 | mkdir -p ${D}${sysconfdir}/logrotate.d |
| 67 | mkdir -p ${D}${localstatedir}/lib |
| 68 | install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf |
| 69 | install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp |
| 70 | install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp |
| 71 | touch ${D}${localstatedir}/lib/logrotate.status |
| 72 | |
| 73 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 74 | install -d ${D}${systemd_system_unitdir} |
| 75 | install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service |
| 76 | install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer |
| 77 | [ -z "${LOGROTATE_OPTIONS}" ] || |
| 78 | sed -ri \ |
| 79 | -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ |
| 80 | ${D}${systemd_system_unitdir}/logrotate.service |
| 81 | sed -ri \ |
| 82 | -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ |
| 83 | -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ |
| 84 | -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ |
| 85 | ${D}${systemd_system_unitdir}/logrotate.timer |
| 86 | fi |
| 87 | |
| 88 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 89 | mkdir -p ${D}${sysconfdir}/cron.daily |
| 90 | install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate |
| 91 | fi |
| 92 | } |