1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 DESCRIPTION="Rotates, compresses, and mails system logs"
9 HOMEPAGE="https://github.com/logrotate/logrotate"
10 SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.gz -> ${P}.tar.gz"
14 KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~x86-fbsd"
15 IUSE="acl +cron selinux"
19 selinux? ( sys-libs/libselinux )
26 selinux? ( sec-policy/selinux-logrotate )
27 cron? ( virtual/cron )"
29 STATEFILE="/var/lib/misc/logrotate.status"
30 OLDSTATEFILE="/var/lib/logrotate.status"
32 move_old_state_file() {
33 elog "logrotate state file is now located at ${STATEFILE}"
34 elog "See bug #357275"
35 if [[ -e "${OLDSTATEFILE}" ]] ; then
36 elog "Moving your current state file to new location: ${STATEFILE}"
37 mv -n "${OLDSTATEFILE}" "${STATEFILE}"
42 exeinto /etc/cron.daily
43 newexe "${S}"/examples/logrotate.cron "${PN}"
47 "${FILESDIR}/${P}-ignore-hidden.patch"
51 sed -i -e 's#/usr/sbin/logrotate#/usr/bin/logrotate#' "${S}"/examples/logrotate.{cron,service} || die
56 econf $(use_with acl) $(use_with selinux) --with-state-file-path="${STATEFILE}"
67 dodoc ChangeLog.md examples/logrotate-default
70 doins "${FILESDIR}"/logrotate.conf
72 use cron && install_cron_file
74 systemd_dounit examples/logrotate.{service,timer}
75 systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}".conf
77 keepdir /etc/logrotate.d
82 elog "The ${PN} binary is now installed under /usr/bin. Please"
83 elog "update your links"
86 elog "If you are running systemd you might need to run:"
87 elog "systemd-tmpfiles --create /usr/lib/tmpfiles.d/logrotate.conf"
88 elog "in order to create the new location of the logrotate state file"
90 if [[ -z ${REPLACING_VERSIONS} ]] ; then
91 elog "If you wish to have logrotate e-mail you updates, please"
92 elog "emerge virtual/mailx and configure logrotate in"
93 elog "/etc/logrotate.conf appropriately"
95 elog "Additionally, /etc/logrotate.conf may need to be modified"
96 elog "for your particular needs. See man logrotate for details."