summaryrefslogtreecommitdiff
path: root/openwrt
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt')
-rw-r--r--openwrt/package/Makefile2
-rw-r--r--openwrt/package/bind/Config.in89
-rw-r--r--openwrt/package/bind/Makefile54
-rw-r--r--openwrt/package/httping/Config.in2
-rw-r--r--openwrt/package/httping/Makefile2
-rw-r--r--openwrt/package/logrotate/Config.in10
-rw-r--r--openwrt/package/logrotate/Makefile38
-rw-r--r--openwrt/package/logrotate/files/logrotate.conf30
-rw-r--r--openwrt/package/logrotate/ipkg/logrotate.control6
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-dateext-maxage.patch433
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-datehack.patch12
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-ignore-hidden.patch14
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-no-tmpdir.patch54
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-taboo-to-debug.patch12
-rw-r--r--openwrt/package/logrotate/patches/logrotate-3.7.1-weekly.patch22
15 files changed, 773 insertions, 7 deletions
diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile
index 94a68f75c2..47a6821e09 100644
--- a/openwrt/package/Makefile
+++ b/openwrt/package/Makefile
@@ -117,6 +117,7 @@ package-$(BR2_PACKAGE_LIBXML2) += libxml2
package-$(BR2_PACKAGE_LIBXSLT) += libxslt
package-$(BR2_PACKAGE_LIGHTTPD) += lighttpd
package-$(BR2_PACKAGE_LINUX_ATM) += linux-atm
+package-$(BR2_PACKAGE_LOGROTATE) += logrotate
package-$(BR2_PACKAGE_LRZSZ) += lrzsz
package-$(BR2_COMPILE_LUA) += lua
package-$(BR2_PACKAGE_MACCHANGER) += macchanger
@@ -311,6 +312,7 @@ libvorbis-compile: libogg-compile
libxml2-compile: zlib-compile
libxslt-compile: libxml2-compile
lighttpd-compile: openssl-compile pcre-compile
+logrotate-compile: popt-compile
madplay-compile: libid3tag-compile libmad-compile
miax-compile: bluez-libs-compile
miredo-compile: uclibc++-compile
diff --git a/openwrt/package/bind/Config.in b/openwrt/package/bind/Config.in
index 38dc92f6f4..34a33c4503 100644
--- a/openwrt/package/bind/Config.in
+++ b/openwrt/package/bind/Config.in
@@ -1,10 +1,89 @@
-#menu "bind.............................. A DNS server implementation"
+menu "bind.............................. A DNS server implementation"
config BR2_COMPILE_BIND
tristate
default n
- depends BR2_PACKAGE_BIND_CLIENT || BR2_PACKAGE_BIND_SERVER
-
+ depends BR2_PACKAGE_BIND_CLIENT || BR2_PACKAGE_BIND_SERVER || BR2_PACKAGE_BIND_TOOLS || BR2_PACKAGE_BIND_RNDC || BR2_PACKAGE_BIND_CHECK || BR2_PACKAGE_BIND_DNSSEC || BR2_PACKAGE_BIND_HOST || BR2_PACKAGE_BIND_DIG
+
+config BR2_PACKAGE_BIND_TOOLS
+ prompt "bind-tools........................ Bind administration tools"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ dig, host, nsupdate, dnssec-keygen, dnssec-signzone, named-checkconf, named-checkzone, rndc, rndc-confgen
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+config BR2_PACKAGE_BIND_RNDC
+ prompt "bind-rndc......................... Bind administration tools (rndc & rndc-confgen only)"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ rndc, rndc-confgen
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+config BR2_PACKAGE_BIND_CHECK
+ prompt "bind-check........................ Bind administration tools (named-checkconf & named-checkzone only)"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ named-checkconf, named-checkzone
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+config BR2_PACKAGE_BIND_DNSSEC
+ prompt "bind-dnssec....................... Bind administration tools (dnssec-keygen & dnssec-signzone only)"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ dnssec-keygen, dnssec-signzone
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+config BR2_PACKAGE_BIND_HOST
+ prompt "bind-host......................... A simple DNS client"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ host
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+config BR2_PACKAGE_BIND_DIG
+ prompt "bind-dig.......................... A DNS client"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_COMPILE_BIND
+ select BR2_PACKAGE_LIBOPENSSL
+ help
+ dig
+
+ http://www.isc.org/sw/bind/
+
+ Depends: openssl
+
+
config BR2_PACKAGE_BIND_CLIENT
prompt "bind-client....................... A dynamic DNS client"
tristate
@@ -29,6 +108,6 @@ config BR2_PACKAGE_BIND_SERVER
http://www.isc.org/sw/bind/
- Depends: openssl
+ Depends: libopenssl
-#endmenu
+endmenu
diff --git a/openwrt/package/bind/Makefile b/openwrt/package/bind/Makefile
index ba895f3c03..f635ef4ea1 100644
--- a/openwrt/package/bind/Makefile
+++ b/openwrt/package/bind/Makefile
@@ -19,6 +19,13 @@ include $(TOPDIR)/package/rules.mk
$(eval $(call PKG_template,BIND_SERVER,bind-server,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
$(eval $(call PKG_template,BIND_CLIENT,bind-client,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_TOOLS,bind-tools,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_RNDC,bind-rndc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_CHECK,bind-check,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_DNSSEC,bind-dnssec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_HOST,bind-host,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,BIND_DIG,bind-dig,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
$(PKG_BUILD_DIR)/.configured:
(cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
@@ -82,3 +89,50 @@ $(IPKG_BIND_CLIENT):
$(CP) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(IDIR_BIND_CLIENT)/usr/bin/
$(RSTRIP) $(IDIR_BIND_CLIENT)
$(IPKG_BUILD) $(IDIR_BIND_CLIENT) $(PACKAGE_DIR)
+
+$(IPKG_BIND_TOOLS):
+ install -d -m0755 $(IDIR_BIND_TOOLS)/usr/bin
+ install -d -m0755 $(IDIR_BIND_TOOLS)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/dig $(IDIR_BIND_TOOLS)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/host $(IDIR_BIND_TOOLS)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(IDIR_BIND_TOOLS)/usr/sbin/
+ $(RSTRIP) $(IDIR_BIND_TOOLS)
+ $(IPKG_BUILD) $(IDIR_BIND_TOOLS) $(PACKAGE_DIR)
+
+$(IPKG_BIND_RNDC):
+ install -d -m0755 $(IDIR_BIND_RNDC)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(IDIR_BIND_RNDC)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(IDIR_BIND_RNDC)/usr/sbin/
+ $(RSTRIP) $(IDIR_BIND_RNDC)
+ $(IPKG_BUILD) $(IDIR_BIND_RNDC) $(PACKAGE_DIR)
+
+$(IPKG_BIND_CHECK):
+ install -d -m0755 $(IDIR_BIND_CHECK)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(IDIR_BIND_CHECK)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(IDIR_BIND_CHECK)/usr/sbin/
+ $(RSTRIP) $(IDIR_BIND_CHECK)
+ $(IPKG_BUILD) $(IDIR_BIND_CHECK) $(PACKAGE_DIR)
+
+$(IPKG_BIND_DNSSEC):
+ install -d -m0755 $(IDIR_BIND_DNSSEC)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(IDIR_BIND_DNSSEC)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(IDIR_BIND_DNSSEC)/usr/sbin/
+ $(RSTRIP) $(IDIR_BIND_DNSSEC)
+ $(IPKG_BUILD) $(IDIR_BIND_DNSSEC) $(PACKAGE_DIR)
+
+$(IPKG_BIND_HOST):
+ install -d -m0755 $(IDIR_BIND_HOST)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/host $(IDIR_BIND_HOST)/usr/bin/
+ $(RSTRIP) $(IDIR_BIND_HOST)
+ $(IPKG_BUILD) $(IDIR_BIND_HOST) $(PACKAGE_DIR)
+
+$(IPKG_BIND_DIG):
+ install -d -m0755 $(IDIR_BIND_DIG)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/dig $(IDIR_BIND_DIG)/usr/bin/
+ $(RSTRIP) $(IDIR_BIND_DIG)
+ $(IPKG_BUILD) $(IDIR_BIND_DIG) $(PACKAGE_DIR)
diff --git a/openwrt/package/httping/Config.in b/openwrt/package/httping/Config.in
index 2b8ef02707..4ba8455db3 100644
--- a/openwrt/package/httping/Config.in
+++ b/openwrt/package/httping/Config.in
@@ -1,7 +1,7 @@
menu "httping........................... Httping is like 'ping' but for http-requests."
config BR2_PACKAGE_HTTPING
- prompt "httping.............................. Httping is like 'ping' but for http-requests."
+ prompt "httping............................ Httping is like 'ping' but for http-requests."
tristate
default m if CONFIG_DEVEL
help
diff --git a/openwrt/package/httping/Makefile b/openwrt/package/httping/Makefile
index 027aac9201..78d6274315 100644
--- a/openwrt/package/httping/Makefile
+++ b/openwrt/package/httping/Makefile
@@ -34,7 +34,7 @@ $(PKG_BUILD_DIR)/.built:
$(IPKG_HTTPING):
mkdir -p $(IDIR_HTTPING)/usr/sbin
echo "Depends: $(PKG_DEPEND)" >> $(IDIR_HTTPING)/CONTROL/control
- cp $(PKG_BUILD_DIR)/$(PKG_NAME) $(IDIR_HTTPING)/usr/sbin/
+ $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(IDIR_HTTPING)/usr/sbin/
$(STRIP) $(IDIR_HTTPING)/usr/sbin/*
$(IPKG_BUILD) $(IDIR_HTTPING) $(PACKAGE_DIR)
diff --git a/openwrt/package/logrotate/Config.in b/openwrt/package/logrotate/Config.in
new file mode 100644
index 0000000000..7a210b7266
--- /dev/null
+++ b/openwrt/package/logrotate/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LOGROTATE
+ prompt "logrotate......................... rotates, compresses, and mails system logs"
+ tristate
+ default m if CONFIG_DEVEL
+ select BR2_PACKAGE_LIBPOPT
+ help
+ logrotate is designed to ease administration of systems that generate
+ large numbers of log files. It allows auto-matic rotation, compression,
+ removal, and mailing of log files. Each log file may be handled
+ daily, weekly,monthly, or when it grows too large.
diff --git a/openwrt/package/logrotate/Makefile b/openwrt/package/logrotate/Makefile
new file mode 100644
index 0000000000..e6ee9e98bd
--- /dev/null
+++ b/openwrt/package/logrotate/Makefile
@@ -0,0 +1,38 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=logrotate
+PKG_VERSION:=3.7.1
+PKG_RELEASE:=1
+PKG_MD5SUM:=552639142e163745f6bcd4f1f3816d8a
+
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/l/logrotate
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_CAT:=zcat
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(TOPDIR)/package/rules.mk
+
+$(eval $(call PKG_template,LOGROTATE,$(PKG_NAME),$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
+ touch $@
+
+$(PKG_BUILD_DIR)/.built:
+ make -C ${PKG_BUILD_DIR} \
+ CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
+ LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
+ CC=$(TARGET_CC) logrotate
+ touch $@
+
+$(IPKG_LOGROTATE):
+ mkdir -p $(IDIR_LOGROTATE)/usr/sbin
+ $(CP) ${PKG_BUILD_DIR}/logrotate $(IDIR_LOGROTATE)/usr/sbin
+ mkdir -p $(IDIR_LOGROTATE)/etc/logrotate.d
+ $(CP) ./files/logrotate.conf $(IDIR_LOGROTATE)/etc
+ $(RSTRIP) $(IDIR_LOGROTATE)
+ $(IPKG_BUILD) $(IDIR_LOGROTATE) $(PACKAGE_DIR)
+
+mostlyclean:
+ make -C $(PKG_BUILD_DIR) clean
+ rm $(PKG_BUILD_DIR)/.built
diff --git a/openwrt/package/logrotate/files/logrotate.conf b/openwrt/package/logrotate/files/logrotate.conf
new file mode 100644
index 0000000000..9a91db94f3
--- /dev/null
+++ b/openwrt/package/logrotate/files/logrotate.conf
@@ -0,0 +1,30 @@
+# rotate log files weekly
+weekly
+#daily
+
+# keep 4 weeks worth of backlogs
+rotate 4
+
+# create new (empty) log files after rotating old ones
+create
+
+notifempty
+nomail
+#olddir /var/log/backup/
+missingok
+#dateext
+
+# uncomment this if you want your log files compressed
+#compress
+
+# packages can drop log rotation information into this directory
+include /etc/logrotate.d
+
+# no packages own lastlog or wtmp -- we'll rotate them here
+#/var/log/wtmp {
+# monthly
+# create 0664 root utmp
+# rotate 1
+#}
+
+# system-specific logs may be also be configured here.
diff --git a/openwrt/package/logrotate/ipkg/logrotate.control b/openwrt/package/logrotate/ipkg/logrotate.control
new file mode 100644
index 0000000000..1c984e58f6
--- /dev/null
+++ b/openwrt/package/logrotate/ipkg/logrotate.control
@@ -0,0 +1,6 @@
+Package: logrotate
+Priority: optional
+Section: misc
+Depends: libpopt
+Source: http://ftp.debian.org/debian/pool/main/l/logrotate
+Description: logrotate is designed to ease administration of systems that generate large numbers of log files.
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-dateext-maxage.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-dateext-maxage.patch
new file mode 100644
index 0000000000..1623b4bf12
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-dateext-maxage.patch
@@ -0,0 +1,433 @@
+diff -u -ruN logrotate-3.7.1.orig/config.c logrotate-3.7.1/config.c
+--- logrotate-3.7.1.orig/config.c 2003-08-07 07:13:14.000000000 -0400
++++ logrotate-3.7.1/config.c 2005-05-24 12:21:09.000000000 -0400
+@@ -511,6 +511,14 @@
+ newlog->flags &= ~LOG_FLAG_IFEMPTY;
+
+ *endtag = oldchar, start = endtag;
++ } else if (!strcmp(start, "dateext")) {
++ newlog->flags |= LOG_FLAG_DATEEXT;
++
++ *endtag = oldchar, start = endtag;
++ } else if (!strcmp(start, "nodateext")) {
++ newlog->flags &= ~LOG_FLAG_DATEEXT;
++
++ *endtag = oldchar, start = endtag;
+ } else if (!strcmp(start, "noolddir")) {
+ newlog->oldDir = NULL;
+
+@@ -670,6 +678,21 @@
+ }
+ *endtag = oldchar, start = endtag;
+ }
++ } else if (!strcmp(start, "maxage")) {
++ *endtag = oldchar, start = endtag;
++
++ if (!isolateValue(configFile, lineNum, "maxage count", &start,
++ &endtag)) {
++ oldchar = *endtag, *endtag = '\0';
++
++ newlog->rotateAge = strtoul(start, &chptr, 0);
++ if (*chptr || newlog->rotateAge < 0) {
++ message(MESS_ERROR, "%s:%d bad maximum age '%s'\n",
++ configFile, lineNum, start);
++ return 1;
++ }
++ *endtag = oldchar, start = endtag;
++ }
+ } else if (!strcmp(start, "errors")) {
+ message(MESS_DEBUG, "%s: %d: the errors directive is deprecated and no longer used.\n",
+ configFile, lineNum);
+diff -u -ruN logrotate-3.7.1.orig/logrotate.8 logrotate-3.7.1/logrotate.8
+--- logrotate-3.7.1.orig/logrotate.8 2003-08-07 07:13:14.000000000 -0400
++++ logrotate-3.7.1/logrotate.8 2005-05-24 12:21:09.000000000 -0400
+@@ -200,6 +200,11 @@
+ Log files are rotated every day.
+
+ .TP
++\fBdateext\fR
++Archive old versions of log files adding a daily extension like YYYYMMDD
++instead of simply adding a number.
++
++.TP
+ \fBdelaycompress\fR
+ Postpone compression of the previous log file to the next rotation cycle.
+ This has only effect when used in combination with \fBcompress\fR.
+@@ -246,6 +251,12 @@
+ instead of the just-rotated file (this is the default).
+
+ .TP
++\fBmaxage\fR \fIcount\fR
++Remove rotated logs older than <count> days. The age is only checked
++if the logfile is to be rotated. The files are mailed to the
++configured address if \fBmaillast\fR and \fBmail\fR are configured.
++
++.TP
+ \fBmissingok\fR
+ If the log file is missing, go on to the next one without issuing an error
+ message. See also \fBnomissingok\fR.
+diff -u -ruN logrotate-3.7.1.orig/logrotate.c logrotate-3.7.1/logrotate.c
+--- logrotate-3.7.1.orig/logrotate.c 2004-10-19 17:41:24.000000000 -0400
++++ logrotate-3.7.1/logrotate.c 2005-05-24 12:21:09.000000000 -0400
+@@ -11,6 +11,7 @@
+ #include <sys/wait.h>
+ #include <time.h>
+ #include <unistd.h>
++#include <glob.h>
+
+ #ifdef WITH_SELINUX
+ #include <selinux/selinux.h>
+@@ -22,6 +23,10 @@
+ #include "log.h"
+ #include "logrotate.h"
+
++#if !defined(GLOB_ABORTED) && defined(GLOB_ABEND)
++#define GLOB_ABORTED GLOB_ABEND
++#endif
++
+ typedef struct {
+ char * fn;
+ struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */
+@@ -42,6 +47,14 @@
+ char * mailCommand = DEFAULT_MAIL_COMMAND;
+ time_t nowSecs = 0;
+
++static int globerr(const char * pathname, int theerr) {
++ message(MESS_ERROR, "error accessing %s: %s\n", pathname,
++ strerror(theerr));
++
++ /* We want the glob operation to continue, so return 0 */
++ return 1;
++}
++
+ static logState * findState(const char * fn, struct stateSet * sip) {
+ int i;
+ logState * states = sip->states;
+@@ -49,9 +62,11 @@
+ struct tm now = *localtime(&nowSecs);
+ time_t lr_time;
+
++ /* find the filename fn in the statesPtr list */
+ for (i = 0; i < numStates; i++)
+ if (!strcmp(fn, states[i].fn)) break;
+
++ /* not in statesPtr list, so add new entry */
+ if (i == numStates) {
+ i = numStates++;
+ states = realloc(states, sizeof(*states) * numStates);
+@@ -121,6 +136,17 @@
+ return rc;
+ }
+
++static int removeLogFile(char * name) {
++ message(MESS_DEBUG, "removing old log %s\n", name);
++
++ if (!debug && unlink(name)) {
++ message(MESS_ERROR, "Failed to remove old log %s: %s\n",
++ name, strerror(errno));
++ return 1;
++ }
++ return 0;
++}
++
+ static int compressLogFile(char * name, logInfo * log, struct stat *sb) {
+ char * compressedName;
+ const char ** fullCommand;
+@@ -265,6 +291,25 @@
+ return rc;
+ }
+
++static int mailLogWrapper (char * mailFilename, char * mailCommand, int logNum, logInfo * log) {
++ /* if the log is compressed (and we're not mailing a
++ * file whose compression has been delayed), we need
++ * to uncompress it */
++ if ((log->flags & LOG_FLAG_COMPRESS) &&
++ !((log->flags & LOG_FLAG_DELAYCOMPRESS) &&
++ (log->flags & LOG_FLAG_MAILFIRST))) {
++ if (mailLog(mailFilename, mailCommand,
++ log->uncompress_prog, log->logAddress,
++ log->files[logNum]))
++ return 1;
++ } else {
++ if (mailLog(mailFilename, mailCommand, NULL,
++ log->logAddress, mailFilename))
++ return 1;
++ }
++ return 0;
++}
++
+ static int copyTruncate(char * currLog, char * saveLog, struct stat * sb, int flags) {
+ char buf[BUFSIZ];
+ int fdcurr = -1, fdsave = -1;
+@@ -479,6 +524,9 @@
+ char * baseName;
+ char * dirName;
+ char * firstRotated;
++ char * glob_pattern;
++ glob_t globResult;
++ int rc;
+ size_t alloc_size;
+ int rotateCount = log->rotateCount ? log->rotateCount : 1;
+ int logStart = (log->logStart == -1) ? 1 : log->logStart;
+@@ -509,7 +557,7 @@
+
+ alloc_size = strlen(dirName) + strlen(baseName) +
+ strlen(log->files[logNum]) + strlen(fileext) +
+- strlen(compext) + 10;
++ strlen(compext) + 18;
+
+ oldName = alloca(alloc_size);
+ newName = alloca(alloc_size);
+@@ -531,16 +579,116 @@
+ /* First compress the previous log when necessary */
+ if (log->flags & LOG_FLAG_COMPRESS &&
+ log->flags & LOG_FLAG_DELAYCOMPRESS) {
+- struct stat sbprev;
+-
+- sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
+- if (stat(oldName, &sbprev)) {
+- message(MESS_DEBUG, "previous log %s does not exist\n",
+- oldName);
+- } else {
+- hasErrors = compressLogFile(oldName, log, &sbprev);
++ if (log->flags & LOG_FLAG_DATEEXT) {
++ /* glob for uncompressed files with our pattern */
++ glob_pattern = malloc(strlen(dirName) + strlen(baseName)
++ + strlen(fileext) + 44 );
++ sprintf(glob_pattern,
++ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s",
++ dirName, baseName, fileext);
++ rc = glob(glob_pattern, 0, globerr, &globResult);
++ if (!rc && globResult.gl_pathc > 0) {
++ for (i = 0; i < globResult.gl_pathc && !hasErrors; i++) {
++ struct stat sbprev;
++ sprintf(oldName,"%s",(globResult.gl_pathv)[i]);
++ if (stat(oldName, &sbprev)) {
++ message(MESS_DEBUG, "previous log %s does not exist\n", oldName);
++ } else {
++ hasErrors = compressLogFile(oldName, log, &sbprev);
++ }
++ }
++ } else {
++ message (MESS_DEBUG, "glob finding logs to compress failed\n");
++ /* fallback to old behaviour */
++ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
++ }
++ globfree(&globResult);
++ free(glob_pattern);
++ } else {
++ struct stat sbprev;
++
++ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
++ if (stat(oldName, &sbprev)) {
++ message(MESS_DEBUG, "previous log %s does not exist\n",
++ oldName);
++ } else {
++ hasErrors = compressLogFile(oldName, log, &sbprev);
++ }
+ }
+ }
++
++ firstRotated = alloca(strlen(dirName) + strlen(baseName) +
++ strlen(fileext) + strlen(compext) + 30);
++
++ if(log->flags & LOG_FLAG_DATEEXT) {
++ /* glob for compressed files with our pattern
++ * and compress ext */
++ glob_pattern = malloc(strlen(dirName)+strlen(baseName)
++ +strlen(fileext)+strlen(compext)+44);
++ sprintf(glob_pattern,
++ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s%s",
++ dirName, baseName, fileext, compext);
++ rc = glob(glob_pattern, 0, globerr, &globResult);
++ if (!rc) {
++ /* search for files to drop, if we find one remember it,
++ * if we find another one mail and remove the first and
++ * remember the second and so on */
++ struct stat fst_buf;
++ int mail_out = -1;
++ /* remove the first (n - rotateCount) matches
++ * no real rotation needed, since the files have
++ * the date in their name */
++ for (i = 0; i < globResult.gl_pathc; i++) {
++ if( !stat((globResult.gl_pathv)[i],&fst_buf) ) {
++ if ((i <= ((int)globResult.gl_pathc - rotateCount))
++ || ((log->rotateAge > 0)
++ && (((nowSecs - fst_buf.st_mtime)/60/60/24)
++ > log->rotateAge))) {
++ if ( mail_out != -1 ) {
++ if (!hasErrors && log->logAddress) {
++ char * mailFilename = (globResult.gl_pathv)[mail_out];
++ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
++ if (!hasErrors)
++ hasErrors = removeLogFile(mailFilename);
++ }
++ }
++ mail_out = i;
++ }
++ }
++ }
++ if ( mail_out != -1 ) {
++ /* oldName is oldest Backup found (for unlink later) */
++ sprintf(oldName, "%s", (globResult.gl_pathv)[mail_out]);
++ strcpy(disposeName, oldName);
++ } else
++ disposeName = NULL;
++ } else {
++ message (MESS_DEBUG, "glob finding old rotated logs failed\n");
++ disposeName = NULL;
++ }
++ /* firstRotated is most recently created/compressed rotated log */
++ sprintf(firstRotated, "%s/%s-%04d%02d%02d%s%s",
++ dirName, baseName, now.tm_year+1900,
++ now.tm_mon+1, now.tm_mday, fileext, compext);
++ globfree(&globResult);
++ free(glob_pattern);
++ } else {
++ if ( log->rotateAge ) {
++ struct stat fst_buf;
++ for (i=1; i <= rotateCount; i++) {
++ sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName,
++ rotateCount + 1, fileext, compext);
++ if(!stat(oldName,&fst_buf)
++ && (((nowSecs - fst_buf.st_mtime)/60/60/24)
++ > log->rotateAge)) {
++ char * mailFilename = (globResult.gl_pathv)[i];
++ if (!hasErrors && log->logAddress)
++ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
++ if (!hasErrors)
++ hasErrors = removeLogFile(mailFilename);
++ }
++ }
++ }
+
+ sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName,
+ logStart + rotateCount, fileext, compext);
+@@ -548,8 +696,6 @@
+
+ strcpy(disposeName, oldName);
+
+- firstRotated = alloca(strlen(dirName) + strlen(baseName) +
+- strlen(fileext) + strlen(compext) + 30);
+ sprintf(firstRotated, "%s/%s.%d%s%s", dirName, baseName,
+ logStart, fileext,
+ (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext);
+@@ -600,12 +746,27 @@
+ }
+ }
+ }
+-
++ } /* !LOG_FLAG_DATEEXT */
++
+ finalName = oldName;
+-
+- /* note: the gzip extension is *not* used here! */
+- sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
+-
++
++ if(log->flags & LOG_FLAG_DATEEXT) {
++ char * destFile = alloca(strlen(dirName) + strlen(baseName) +
++ strlen(fileext) + strlen(compext) + 30);
++ struct stat fst_buf;
++ sprintf(finalName, "%s/%s-%04d%02d%02d%s",
++ dirName, baseName, now.tm_year+1900,
++ now.tm_mon+1, now.tm_mday, fileext);
++ sprintf(destFile, "%s%s", finalName, compext);
++ if(!stat(destFile,&fst_buf)) {
++ message (MESS_DEBUG, "destination %s already exists, skipping rotation\n", firstRotated);
++ hasErrors = 1;
++ }
++ } else {
++ /* note: the gzip extension is *not* used here! */
++ sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
++ }
++
+ /* if the last rotation doesn't exist, that's okay */
+ if (!debug && access(disposeName, F_OK)) {
+ message(MESS_DEBUG, "log %s doesn't exist -- won't try to "
+@@ -613,9 +774,6 @@
+ disposeName = NULL;
+ }
+
+- free(dirName);
+- free(baseName);
+-
+ if (!hasErrors) {
+ if (log->pre && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) {
+ message(MESS_DEBUG, "running prerotate script\n");
+@@ -722,33 +880,12 @@
+ else
+ mailFilename = disposeName;
+
+- if (mailFilename) {
+- /* if the log is compressed (and we're not mailing a
+- file whose compression has been delayed), we need
+- to uncompress it */
+- if ((log->flags & LOG_FLAG_COMPRESS) &&
+- !((log->flags & LOG_FLAG_DELAYCOMPRESS) &&
+- (log->flags & LOG_FLAG_MAILFIRST))) {
+- if (mailLog(mailFilename, mailCommand,
+- log->uncompress_prog, log->logAddress,
+- log->files[logNum]))
+- hasErrors = 1;
+- } else {
+- if (mailLog(mailFilename, mailCommand, NULL,
+- log->logAddress, mailFilename))
+- hasErrors = 1;
+- }
+- }
++ if (mailFilename)
++ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
+ }
+
+ if (!hasErrors && disposeName) {
+- message(MESS_DEBUG, "removing old log %s\n", disposeName);
+-
+- if (!debug && unlink(disposeName)) {
+- message(MESS_ERROR, "Failed to remove old log %s: %s\n",
+- disposeName, strerror(errno));
+- hasErrors = 1;
+- }
++ hasErrors = removeLogFile(disposeName);
+ }
+ }
+
+@@ -761,6 +898,8 @@
+ }
+ }
+ #endif
++ free(dirName);
++ free(baseName);
+ return hasErrors;
+ }
+
+@@ -1047,7 +1186,9 @@
+
+ int main(int argc, const char ** argv) {
+ logInfo defConfig = { NULL, NULL, 0, NULL, ROT_SIZE,
+- /* threshHold */ 1024 * 1024, 0,
++ /* threshHold */ 1024 * 1024,
++ /* rotateCount */ 0,
++ /* rotateAge */ 0,
+ /* log start */ -1,
+ /* pre, post */ NULL, NULL,
+ /* first, last */ NULL, NULL,
+diff -u -ruN logrotate-3.7.1.orig/logrotate.h logrotate-3.7.1/logrotate.h
+--- logrotate-3.7.1.orig/logrotate.h 2003-08-07 07:13:14.000000000 -0400
++++ logrotate-3.7.1/logrotate.h 2005-05-24 12:21:09.000000000 -0400
+@@ -15,6 +15,7 @@
+ #define LOG_FLAG_MAILFIRST (1 << 6)
+ #define LOG_FLAG_SHAREDSCRIPTS (1 << 7)
+ #define LOG_FLAG_COPY (1 << 8)
++#define LOG_FLAG_DATEEXT (1 << 9)
+
+ #define NO_FORCE_ROTATE 0
+ #define FORCE_ROTATE 1
+@@ -34,6 +35,7 @@
+ enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium;
+ unsigned int threshhold;
+ int rotateCount;
++ int rotateAge;
+ int logStart;
+ char * pre, * post, * first, * last;
+ char * logAddress;
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-datehack.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-datehack.patch
new file mode 100644
index 0000000000..69121aafa9
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-datehack.patch
@@ -0,0 +1,12 @@
+diff -u -ruN logrotate-3.7.1.orig/logrotate.c logrotate-3.7.1/logrotate.c
+--- logrotate-3.7.1.orig/logrotate.c 2004-10-19 17:41:24.000000000 -0400
++++ logrotate-3.7.1/logrotate.c 2005-05-24 12:12:26.000000000 -0400
+@@ -1002,7 +1002,7 @@
+ }
+
+ /* Hack to hide earlier bug */
+- if ((year != 1900) && (year < 1996 || year > 2100)) {
++ if ((year != 1900) && (year < 1970 || year > 2100)) {
+ message(MESS_ERROR, "bad year %d for file %s in state file %s\n",
+ year, argv[0], stateFilename);
+ fclose(f);
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-ignore-hidden.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-ignore-hidden.patch
new file mode 100644
index 0000000000..390de7537c
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-ignore-hidden.patch
@@ -0,0 +1,14 @@
+--- logrotate-3.7/config.c.orig 2005-04-26 22:57:53.000000000 -0400
++++ logrotate-3.7/config.c 2005-04-26 22:59:36.000000000 -0400
+@@ -142,6 +142,11 @@
+ (!fname[1] || (fname[1] == '.' && !fname[2])))
+ return 0;
+
++ /* Don't include 'hidden' files either; this breaks Gentoo
++ portage config file management http://bugs.gentoo.org/87683 */
++ if (fname[0] == '.')
++ return 0;
++
+ /* Check if fname is ending in a taboo-extension; if so, return
+ false */
+ for (i = 0; i < tabooCount; i++) {
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-no-tmpdir.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-no-tmpdir.patch
new file mode 100644
index 0000000000..fb95f1ee3e
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-no-tmpdir.patch
@@ -0,0 +1,54 @@
+diff -u -ruN logrotate-3.7.1-cur/logrotate.c logrotate-3.7.1/logrotate.c
+--- logrotate-3.7.1-cur/logrotate.c 2005-05-25 18:20:41.000000000 -0400
++++ logrotate-3.7.1/logrotate.c 2005-05-25 18:21:10.000000000 -0400
+@@ -90,10 +90,7 @@
+ }
+
+ static int runScript(char * logfn, char * script) {
+- int fd;
+- char *filespec;
+ int rc;
+- char buf[256];
+
+ if (debug) {
+ message(MESS_DEBUG, "running script with arg %s: \"%s\"\n",
+@@ -101,38 +98,12 @@
+ return 0;
+ }
+
+- filespec = buf;
+- snprintf(buf, sizeof(buf), "%s/logrotate.XXXXXX", getenv("TMPDIR") ?: "/tmp");
+- fd = -1;
+- if (!filespec || (fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) {
+- message(MESS_DEBUG, "error creating %s: %s\n", filespec,
+- strerror(errno));
+- if (fd >= 0) {
+- close(fd);
+- unlink(filespec);
+- }
+- return -1;
+- }
+-
+- if (write(fd, "#!/bin/sh\n\n", 11) != 11 ||
+- write(fd, script, strlen(script)) != strlen(script)) {
+- message(MESS_DEBUG, "error writing %s\n", filespec);
+- close(fd);
+- unlink(filespec);
+- return -1;
+- }
+-
+- close(fd);
+-
+ if (!fork()) {
+- execlp(filespec, filespec, logfn, NULL);
++ execl("/bin/sh", "sh", "-c", script, NULL);
+ exit(1);
+ }
+
+ wait(&rc);
+-
+- unlink(filespec);
+-
+ return rc;
+ }
+
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-taboo-to-debug.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-taboo-to-debug.patch
new file mode 100644
index 0000000000..2e07188f5a
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-taboo-to-debug.patch
@@ -0,0 +1,12 @@
+diff -u -ruN logrotate-3.7.1.orig/config.c logrotate-3.7.1/config.c
+--- logrotate-3.7.1.orig/config.c 2003-08-07 07:13:14.000000000 -0400
++++ logrotate-3.7.1/config.c 2005-05-24 12:13:41.000000000 -0400
+@@ -147,7 +147,7 @@
+ for (i = 0; i < tabooCount; i++) {
+ if (!strcmp(fname + strlen(fname) - strlen(tabooExts[i]),
+ tabooExts[i])) {
+- message(MESS_ERROR, "Ignoring %s, because of %s "
++ message(MESS_DEBUG, "Ignoring %s, because of %s "
+ "ending\n", fname, tabooExts[i]);
+
+ return 0;
diff --git a/openwrt/package/logrotate/patches/logrotate-3.7.1-weekly.patch b/openwrt/package/logrotate/patches/logrotate-3.7.1-weekly.patch
new file mode 100644
index 0000000000..8a371e8e00
--- /dev/null
+++ b/openwrt/package/logrotate/patches/logrotate-3.7.1-weekly.patch
@@ -0,0 +1,22 @@
+--- logrotate-3.7.1-old/logrotate.c 2004-10-19 23:41:24.000000000 +0200
++++ logrotate-3.7.1-new/logrotate.c 2005-10-02 17:29:22.380767321 +0200
+@@ -424,12 +424,15 @@ int findNeedRotating(logInfo * log, int
+ switch (log->criterium) {
+ case ROT_WEEKLY:
+ /* rotate if:
+- 1) the current weekday is before the weekday of the
+- last rotation
++ 1) the day of the week is the same as the day of the week of
++ the previous rotation but not the same day of the year
++ this will rotate it on the same day every week, but not
++ twice a day.
+ 2) more then a week has passed since the last
+ rotation */
+- state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) ||
+- ((mktime(&now) - mktime(&state->lastRotated)) >
++ state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday &&
++ now.tm_yday != state->lastRotated.tm_yday) ||
++ ((mktime(&now) - mktime(&state->lastRotated)) >
+ (7 * 24 * 3600)));
+ break;
+ case ROT_MONTHLY: