From 96a6435b1c0c79fab75b1db7648951acf787cc19 Mon Sep 17 00:00:00 2001 From: sbd Date: Tue, 6 Mar 2012 04:53:24 +0000 Subject: Add logrotate-3.8.1 as sysutils/logrotate The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files. Logrotate allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size. Normally, logrotate runs as a daily cron job. --- sysutils/logrotate/DESCR | 6 +++ sysutils/logrotate/MESSAGE | 13 +++++ sysutils/logrotate/Makefile | 56 ++++++++++++++++++++++ sysutils/logrotate/PLIST | 10 ++++ sysutils/logrotate/distinfo | 11 +++++ sysutils/logrotate/patches/patch-config.c | 17 +++++++ sysutils/logrotate/patches/patch-config.h | 22 +++++++++ .../patches/patch-examples_logrotate-default | 31 ++++++++++++ .../patches/patch-examples_logrotate.cron | 14 ++++++ sysutils/logrotate/patches/patch-logrotate.8 | 28 +++++++++++ sysutils/logrotate/patches/patch-logrotate.c | 17 +++++++ 11 files changed, 225 insertions(+) create mode 100644 sysutils/logrotate/DESCR create mode 100644 sysutils/logrotate/MESSAGE create mode 100644 sysutils/logrotate/Makefile create mode 100644 sysutils/logrotate/PLIST create mode 100644 sysutils/logrotate/distinfo create mode 100644 sysutils/logrotate/patches/patch-config.c create mode 100644 sysutils/logrotate/patches/patch-config.h create mode 100644 sysutils/logrotate/patches/patch-examples_logrotate-default create mode 100644 sysutils/logrotate/patches/patch-examples_logrotate.cron create mode 100644 sysutils/logrotate/patches/patch-logrotate.8 create mode 100644 sysutils/logrotate/patches/patch-logrotate.c (limited to 'sysutils') diff --git a/sysutils/logrotate/DESCR b/sysutils/logrotate/DESCR new file mode 100644 index 00000000000..b16a265f89d --- /dev/null +++ b/sysutils/logrotate/DESCR @@ -0,0 +1,6 @@ +The logrotate utility is designed to simplify the administration of +log files on a system which generates a lot of log files. Logrotate +allows for the automatic rotation compression, removal and mailing of +log files. Logrotate can be set to handle a log file daily, weekly, +monthly or when the log file gets to a certain size. Normally, +logrotate runs as a daily cron job. diff --git a/sysutils/logrotate/MESSAGE b/sysutils/logrotate/MESSAGE new file mode 100644 index 00000000000..9d2338e35a5 --- /dev/null +++ b/sysutils/logrotate/MESSAGE @@ -0,0 +1,13 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ +To set up ${PKGNAME}: + +1/ modify ${PKG_SYSCONFDIR}/logrotate.conf to your needs, +or better, add your own configuration files in +${PKG_SYSCONFDIR}/logrotate.d/ + +2/ set up a daily cron job for logrotate in ${ROOT_USER}'s crontab; +this can be done with one of the following line: +0 0 * * * /bin/sh ${EGDIR}/logrotate.cron +0 0 * * * ${PREFIX}/bin/logrotate ${PKG_SYSCONFDIR}/logrotate.conf +=========================================================================== diff --git a/sysutils/logrotate/Makefile b/sysutils/logrotate/Makefile new file mode 100644 index 00000000000..d29dba8a853 --- /dev/null +++ b/sysutils/logrotate/Makefile @@ -0,0 +1,56 @@ +# $NetBSD: Makefile,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ +# + +DISTNAME= logrotate-3.8.1 +CATEGORIES= sysutils +MASTER_SITES= ${MASTER_SITE_GENTOO:=distfiles/} +MASTER_SITES+= ${MASTER_SITE_FREEBSD:=distfiles/} + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://fedorahosted.org/logrotate/ +COMMENT= Daemon to rotate, compress, remove and mail system log files +LICENSE= gnu-gpl-v2 + +PKG_DESTDIR_SUPPORT= user-destdir + +USE_TOOLS+= gmake gzip:run gunzip:run mail:run +NO_EXPORT_CPP= yes + +CFLAGS+= -DSTATEFILE=\"${VARBASE}/db/logrotate.status\" +CFLAGS+= -DDEFAULT_MAIL_COMMAND=\"${MAIL_CMD}\" +CFLAGS+= -DCOMPRESS_COMMAND=\"${GZIP_CMD:[1]}\" +CFLAGS+= -DUNCOMPRESS_COMMAND=\"${GUNZIP_CMD:[1]}\" + +MAKE_ENV+= RPM_OPT_FLAGS=${CFLAGS:Q} + +BUILD_DEFS+= VARBASE +EGDIR= ${PREFIX}/share/examples/logrotate +CONF_FILES= ${EGDIR}/logrotate.conf ${PKG_SYSCONFDIR}/logrotate.conf +OWN_DIRS= ${PKG_SYSCONFDIR}/logrotate.d +MESSAGE_SUBST+= EGDIR=${EGDIR} + +AUTO_MKDIRS= yes + +SUBST_CLASSES+= paths +SUBST_STAGE.paths= pre-build +SUBST_MESSAGE.paths= Substituting paths variables. +SUBST_FILES.paths= examples/logrotate-default +SUBST_FILES.paths+= examples/logrotate.cron +SUBST_FILES.paths+= logrotate.8 +SUBST_VARS.paths= PREFIX +SUBST_VARS.paths+= VARBASE +SUBST_VARS.paths+= PKG_SYSCONFDIR + +DOCDIR= share/doc/logrotate +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/logrotate ${DESTDIR}${PREFIX}/sbin + ${INSTALL_DATA} ${WRKSRC}/examples/logrotate-default ${DESTDIR}${EGDIR}/logrotate.conf + ${INSTALL_DATA} ${WRKSRC}/examples/logrotate.cron ${DESTDIR}/${EGDIR} + ${INSTALL_DATA} ${WRKSRC}/README.* ${DESTDIR}${PREFIX}/${DOCDIR} + ${INSTALL_DATA} ${WRKSRC}/CHANGES ${DESTDIR}${PREFIX}/${DOCDIR} + ${INSTALL_DATA} ${WRKSRC}/COPYING ${DESTDIR}${PREFIX}/${DOCDIR} + ${INSTALL_MAN} ${WRKSRC}/logrotate.conf.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5 + ${INSTALL_MAN} ${WRKSRC}/logrotate.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8 + +.include "../../devel/popt/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/logrotate/PLIST b/sysutils/logrotate/PLIST new file mode 100644 index 00000000000..e8385a6977b --- /dev/null +++ b/sysutils/logrotate/PLIST @@ -0,0 +1,10 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ +man/man5/logrotate.conf.5 +man/man8/logrotate.8 +sbin/logrotate +share/doc/logrotate/CHANGES +share/doc/logrotate/COPYING +share/doc/logrotate/README.HPUX +share/doc/logrotate/README.Solaris +share/examples/logrotate/logrotate.conf +share/examples/logrotate/logrotate.cron diff --git a/sysutils/logrotate/distinfo b/sysutils/logrotate/distinfo new file mode 100644 index 00000000000..df0afee79fa --- /dev/null +++ b/sysutils/logrotate/distinfo @@ -0,0 +1,11 @@ +$NetBSD: distinfo,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +SHA1 (logrotate-3.8.1.tar.gz) = 1df36cee76a9c4c7438f35ca3599a7bdd68a09b5 +RMD160 (logrotate-3.8.1.tar.gz) = cec3bc6a4cb4226b31696977935818695027b0f8 +Size (logrotate-3.8.1.tar.gz) = 48827 bytes +SHA1 (patch-config.c) = 4f0f173a193c290578d427b96625f44ceb6ba5e4 +SHA1 (patch-config.h) = f0b52b984d0711e2250326805c2a3f7582807d48 +SHA1 (patch-examples_logrotate-default) = 01fedd4e0f62231c670dd0c023776136c006f2d8 +SHA1 (patch-examples_logrotate.cron) = 02981cb2b49e3f3f500fcb3db9b5dcb5fe62bddc +SHA1 (patch-logrotate.8) = f37f746a3cccfd81e322ca5ef52c6fcb67d337d9 +SHA1 (patch-logrotate.c) = b5a3bb73329f30608edc5c73b00956492fc81637 diff --git a/sysutils/logrotate/patches/patch-config.c b/sysutils/logrotate/patches/patch-config.c new file mode 100644 index 00000000000..1e2ae421248 --- /dev/null +++ b/sysutils/logrotate/patches/patch-config.c @@ -0,0 +1,17 @@ +$NetBSD: patch-config.c,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Compatibility patch for systems not using alloca.h . +Patch commited upstream + +--- config.c.orig 2011-08-31 12:39:04.000000000 +0000 ++++ config.c +@@ -1,6 +1,9 @@ + #include ++#ifdef _ALLOCA_H + #include ++#else + #include ++#endif + #include + #include + #include diff --git a/sysutils/logrotate/patches/patch-config.h b/sysutils/logrotate/patches/patch-config.h new file mode 100644 index 00000000000..3fd5c09e45a --- /dev/null +++ b/sysutils/logrotate/patches/patch-config.h @@ -0,0 +1,22 @@ +$NetBSD: patch-config.h,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Values will be passed from pkgsrc. + +--- config.h.orig 2011-08-31 12:39:04.000000000 +0000 ++++ config.h +@@ -4,6 +4,7 @@ + + #define ROOT_UID 0 + ++/* + #ifdef __hpux + #define DEFAULT_MAIL_COMMAND "/usr/bin/mailx" + #define COMPRESS_COMMAND "/usr/contrib/bin/gzip" +@@ -24,6 +25,7 @@ + #define UNCOMPRESS_COMMAND "/usr/bin/gunzip" + #define STATEFILE "/var/log/logrotate.status" + #endif ++*/ + + /* + * Default settings for Linux - leave these last. diff --git a/sysutils/logrotate/patches/patch-examples_logrotate-default b/sysutils/logrotate/patches/patch-examples_logrotate-default new file mode 100644 index 00000000000..ed1a1d17e9c --- /dev/null +++ b/sysutils/logrotate/patches/patch-examples_logrotate-default @@ -0,0 +1,31 @@ +$NetBSD: patch-examples_logrotate-default,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Add pkgsrc paths compatibility. + +--- examples/logrotate-default.orig 2011-08-31 12:39:04.000000000 +0000 ++++ examples/logrotate-default +@@ -14,22 +14,7 @@ dateext + # uncomment this if you want your log files compressed + #compress + +-# RPM packages drop log rotation information into this directory +-include /etc/logrotate.d +- +-# no packages own wtmp and btmp -- we'll rotate them here +-/var/log/wtmp { +- monthly +- create 0664 root utmp +- minsize 1M +- rotate 1 +-} +- +-/var/log/btmp { +- missingok +- monthly +- create 0600 root utmp +- rotate 1 +-} ++# Packages drop log rotation information into this directory ++include @PKG_SYSCONFDIR@/etc/logrotate.d + + # system-specific logs may be also be configured here. diff --git a/sysutils/logrotate/patches/patch-examples_logrotate.cron b/sysutils/logrotate/patches/patch-examples_logrotate.cron new file mode 100644 index 00000000000..490c6e0a5d8 --- /dev/null +++ b/sysutils/logrotate/patches/patch-examples_logrotate.cron @@ -0,0 +1,14 @@ +$NetBSD: patch-examples_logrotate.cron,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Add pkgsrc paths compatibility + +--- examples/logrotate.cron.orig 2011-08-31 12:39:04.000000000 +0000 ++++ examples/logrotate.cron +@@ -1,6 +1,6 @@ + #!/bin/sh + +-/usr/sbin/logrotate /etc/logrotate.conf ++@PREFIX@/sbin/logrotate @PKG_SYSCONFDIR@/logrotate.conf + EXITVALUE=$? + if [ $EXITVALUE != 0 ]; then + /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" diff --git a/sysutils/logrotate/patches/patch-logrotate.8 b/sysutils/logrotate/patches/patch-logrotate.8 new file mode 100644 index 00000000000..a84e5158d0a --- /dev/null +++ b/sysutils/logrotate/patches/patch-logrotate.8 @@ -0,0 +1,28 @@ +$NetBSD: patch-logrotate.8,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Add pkgsrc paths compatibility + +--- logrotate.8.orig 2011-08-31 12:39:04.000000000 +0000 ++++ logrotate.8 +@@ -59,7 +59,7 @@ and mail it to the recipient. The defaul + \fB-s, -\-state \fR + Tells \fBlogrotate\fR to use an alternate state file. This is useful + if logrotate is being run as a different user for various sets of +-log files. The default state file is \fI/var/lib/logrotate.status\fR. ++log files. The default state file is \fI@VARBASE@/log/logrotate.status\fR. + + .TP + \fB-\-usage\fR +@@ -499,10 +499,10 @@ Log files are rotated if the current yea + .SH FILES + .PD 0 + .TP 27 +-\fI/var/lib/logrotate.status\fR ++\fI@VARBASE@/log/logrotate.status\fR + Default state file. + .TP 27 +-\fI/etc/logrotate.conf\fR ++\fI@PKG_SYSCONFDIR@/logrotate.conf\fR + Configuration options. + + .SH SEE ALSO diff --git a/sysutils/logrotate/patches/patch-logrotate.c b/sysutils/logrotate/patches/patch-logrotate.c new file mode 100644 index 00000000000..aab0a4103cb --- /dev/null +++ b/sysutils/logrotate/patches/patch-logrotate.c @@ -0,0 +1,17 @@ +$NetBSD: patch-logrotate.c,v 1.1.1.1 2012/03/06 04:53:24 sbd Exp $ + +Compatibility patch for systems not using alloca.h . +Patch commited upstream. + +--- logrotate.c.orig 2011-08-31 12:39:04.000000000 +0000 ++++ logrotate.c +@@ -1,6 +1,9 @@ + #include ++#ifdef _ALLOCA_H + #include ++#else + #include ++#endif + #include + #include + #include -- cgit v1.2.3