diff options
Diffstat (limited to 'meta/recipes-extended/logrotate/logrotate_3.21.0.bb')
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate_3.21.0.bb | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/recipes-extended/logrotate/logrotate_3.21.0.bb b/meta/recipes-extended/logrotate/logrotate_3.21.0.bb new file mode 100644 index 0000000000..10a6149abc --- /dev/null +++ b/meta/recipes-extended/logrotate/logrotate_3.21.0.bb | |||
@@ -0,0 +1,114 @@ | |||
1 | SUMMARY = "Rotates, compresses, removes and mails system log files" | ||
2 | SECTION = "console/utils" | ||
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." | ||
5 | LICENSE = "GPL-2.0-only" | ||
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 | |||
13 | SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.xz \ | ||
14 | file://run-ptest \ | ||
15 | " | ||
16 | |||
17 | SRC_URI[sha256sum] = "8fa12015e3b8415c121fc9c0ca53aa872f7b0702f543afda7e32b6c4900f6516" | ||
18 | |||
19 | CVE_STATUS_GROUPS = "CVE_STATUS_RECIPE" | ||
20 | CVE_STATUS_RECIPE = "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" | ||
21 | CVE_STATUS_RECIPE[status] = "not-applicable-platform: CVE is debian, gentoo or SUSE specific on the way logrotate was installed/used" | ||
22 | |||
23 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" | ||
24 | |||
25 | PACKAGECONFIG[acl] = ",,acl" | ||
26 | PACKAGECONFIG[selinux] = ",,libselinux" | ||
27 | |||
28 | CONFFILES:${PN} += "${localstatedir}/lib/logrotate.status \ | ||
29 | ${sysconfdir}/logrotate.conf \ | ||
30 | ${sysconfdir}/logrotate.d/btmp \ | ||
31 | ${sysconfdir}/logrotate.d/wtmp" | ||
32 | |||
33 | # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our | ||
34 | # optimization variables, so use it rather than EXTRA_CFLAGS. | ||
35 | EXTRA_OEMAKE = "\ | ||
36 | LFS= \ | ||
37 | OS_NAME='${OS_NAME}' \ | ||
38 | 'CC=${CC}' \ | ||
39 | 'RPM_OPT_FLAGS=${CFLAGS}' \ | ||
40 | 'EXTRA_LDFLAGS=${LDFLAGS}' \ | ||
41 | ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ | ||
42 | ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ | ||
43 | " | ||
44 | |||
45 | # OS_NAME in the makefile defaults to `uname -s`. The behavior for | ||
46 | # freebsd/netbsd is questionable, so leave it as Linux, which only sets | ||
47 | # INSTALL=install and BASEDIR=/usr. | ||
48 | OS_NAME = "Linux" | ||
49 | |||
50 | inherit autotools systemd github-releases ptest | ||
51 | |||
52 | SYSTEMD_SERVICE:${PN} = "\ | ||
53 | ${BPN}.service \ | ||
54 | ${BPN}.timer \ | ||
55 | " | ||
56 | |||
57 | LOGROTATE_OPTIONS ?= "" | ||
58 | |||
59 | LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" | ||
60 | LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" | ||
61 | LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" | ||
62 | |||
63 | do_install(){ | ||
64 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} | ||
65 | mkdir -p ${D}${sysconfdir}/logrotate.d | ||
66 | mkdir -p ${D}${localstatedir}/lib | ||
67 | install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf | ||
68 | install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp | ||
69 | install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp | ||
70 | |||
71 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
72 | install -d ${D}${systemd_system_unitdir} | ||
73 | install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service | ||
74 | install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer | ||
75 | [ -z "${LOGROTATE_OPTIONS}" ] || | ||
76 | sed -ri \ | ||
77 | -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ | ||
78 | ${D}${systemd_system_unitdir}/logrotate.service | ||
79 | sed -ri \ | ||
80 | -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ | ||
81 | -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ | ||
82 | -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ | ||
83 | ${D}${systemd_system_unitdir}/logrotate.timer | ||
84 | fi | ||
85 | |||
86 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
87 | mkdir -p ${D}${sysconfdir}/cron.daily | ||
88 | install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate | ||
89 | fi | ||
90 | } | ||
91 | |||
92 | do_install_ptest() { | ||
93 | cp -r ${S}/test/* ${D}${PTEST_PATH} | ||
94 | cp ${S}/test-driver ${D}${PTEST_PATH} | ||
95 | cp ${B}/test/Makefile ${D}${PTEST_PATH} | ||
96 | |||
97 | # Do not rebuild Makefile | ||
98 | sed -i 's/^Makefile:/_Makefile:/' ${D}${PTEST_PATH}/Makefile | ||
99 | |||
100 | # Fix top_builddir and top_srcdir | ||
101 | sed -e 's/^top_builddir = \(.*\)/top_builddir = ./' \ | ||
102 | -e 's/^top_srcdir = \(.*\)/top_srcdir = ./' \ | ||
103 | -i ${D}${PTEST_PATH}/Makefile | ||
104 | |||
105 | # Replace bash with sh | ||
106 | sed -i 's,/bin/bash,/bin/sh,' ${D}${PTEST_PATH}/Makefile | ||
107 | |||
108 | # Replace gawk with awk | ||
109 | sed -i 's/gawk/awk/' ${D}${PTEST_PATH}/Makefile | ||
110 | ln -s ${sbindir}/logrotate ${D}${PTEST_PATH} | ||
111 | } | ||
112 | |||
113 | # coreutils is needed to have "readlink" | ||
114 | RDEPENDS:${PN}-ptest += "make coreutils" | ||