diff --git a/logrotate/PKGBUILD b/logrotate/PKGBUILD new file mode 100644 index 000000000..8c3eea912 --- /dev/null +++ b/logrotate/PKGBUILD @@ -0,0 +1,51 @@ +pkgname=logrotate +pkgver=3.9.2 +pkgrel=1 +pkgdesc="Rotates system logs automatically" +arch=('x86_64') +url="https://fedorahosted.org/logrotate/" +license=('GPL') +groups=('base') +depends=('popt' 'gzip' 'acl') +backup=('etc/logrotate.conf') +source=("https://github.com/logrotate/logrotate/archive/${pkgver}.tar.gz" + 'paths.patch' + 'logrotate.conf' + logrotate.{timer,service}) +sha1sums=('5a3c1784890aa5f4d4df2c438ab6b02b9bad37f7' + 'da069a389f74526648aca8d675f92bb28cd20e42' + '2d2678ad876e292d4f4d93f92041e4a158c5c362' + 'db8b531121793baaf68e05f6bd0f86da918c56e0' + '017bb1373ed4cde5b29e16932741eca7b440bb44') + +build() { + cd "$srcdir/${pkgname}-${pkgver}" + + patch -p0 -i "$srcdir/paths.patch" + + ./autogen.sh + ./configure \ + --prefix=/usr \ + --sbindir=/usr/bin \ + --mandir=/usr/share/man \ + --with-acl + make +} + +check() { + cd "$srcdir/${pkgname}-${pkgver}" + make test +} + +package() { + cd "$srcdir/${pkgname}-${pkgver}" + make DESTDIR="$pkgdir" install + + install -dm755 "$pkgdir/etc/logrotate.d" + install -Dm644 "$srcdir/logrotate.conf" "$pkgdir/etc/logrotate.conf" + + install -D -m644 ${srcdir}/logrotate.timer ${pkgdir}/usr/lib/systemd/system/logrotate.timer + install -D -m644 ${srcdir}/logrotate.service ${pkgdir}/usr/lib/systemd/system/logrotate.service + install -d -m755 ${pkgdir}/usr/lib/systemd/system/multi-user.target.wants + ln -s ../logrotate.timer ${pkgdir}/usr/lib/systemd/system/multi-user.target.wants/logrotate.timer +} diff --git a/logrotate/logrotate.conf b/logrotate/logrotate.conf new file mode 100644 index 000000000..4193a3a7f --- /dev/null +++ b/logrotate/logrotate.conf @@ -0,0 +1,38 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# keep 4 weeks worth of backlogs +rotate 4 + +# restrict maximum size of log files +#size 20M + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +#compress + +# Logs are moved into directory for rotation +# olddir /var/log/archive + +# Ignore pacman saved files +tabooext + .pacorig .pacnew .pacsave + +# Arch packages drop log rotation information into this directory +include /etc/logrotate.d + +/var/log/wtmp { + monthly + create 0664 root utmp + minsize 1M + rotate 1 +} + +/var/log/btmp { + missingok + monthly + create 0600 root utmp + rotate 1 +} diff --git a/logrotate/logrotate.service b/logrotate/logrotate.service new file mode 100644 index 000000000..3a483c3a3 --- /dev/null +++ b/logrotate/logrotate.service @@ -0,0 +1,9 @@ +[Unit] +Description=Rotate log files + +[Service] +Type=oneshot +ExecStart=/usr/bin/logrotate /etc/logrotate.conf +Nice=19 +IOSchedulingClass=best-effort +IOSchedulingPriority=7 diff --git a/logrotate/logrotate.timer b/logrotate/logrotate.timer new file mode 100644 index 000000000..a92ba1ecc --- /dev/null +++ b/logrotate/logrotate.timer @@ -0,0 +1,7 @@ +[Unit] +Description=Daily rotation of log files + +[Timer] +OnCalendar=daily +AccuracySec=12h +Persistent=true diff --git a/logrotate/paths.patch b/logrotate/paths.patch new file mode 100644 index 000000000..83166b095 --- /dev/null +++ b/logrotate/paths.patch @@ -0,0 +1,25 @@ +--- config.h 2012-08-01 12:56:47.000000000 +0200 ++++ config.h 2012-08-03 09:53:05.025039199 +0200 +@@ -27,11 +27,11 @@ + * Default settings for Linux - leave these last. + */ + #ifndef DEFAULT_MAIL_COMMAND +-#define DEFAULT_MAIL_COMMAND "/bin/mail" ++#define DEFAULT_MAIL_COMMAND "/usr/bin/mail" + #endif + + #ifndef COMPRESS_COMMAND +-#define COMPRESS_COMMAND "/bin/gzip" ++#define COMPRESS_COMMAND "/usr/bin/gzip" + #endif + + #ifndef COMPRESS_EXT +@@ -39,7 +39,7 @@ + #endif + + #ifndef UNCOMPRESS_COMMAND +-#define UNCOMPRESS_COMMAND "/bin/gunzip" ++#define UNCOMPRESS_COMMAND "/usr/bin/gunzip" + #endif + + #ifndef STATEFILE