aboutsummaryrefslogtreecommitdiffstats
path: root/main/sysklogd/sysklogd.daily
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-09-02 15:18:40 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-09-02 15:18:40 +0000
commit6c890d6e6624ff6debcfb070d1d7fa88db0bc4ad (patch)
treef30455349f1f70b1f584b789d8ea34eaed680f6e /main/sysklogd/sysklogd.daily
parent595935f999281e7de19fe7b1135adf0f2cdd290e (diff)
downloadaports-6c890d6e6624ff6debcfb070d1d7fa88db0bc4ad.tar.bz2
aports-6c890d6e6624ff6debcfb070d1d7fa88db0bc4ad.tar.xz
main/sysklogd: fix logrotation script
the syslogd_listfiles didnt handle the --auth option properly. We fix this and make it slightly more readable with -e ref #408
Diffstat (limited to 'main/sysklogd/sysklogd.daily')
-rwxr-xr-xmain/sysklogd/sysklogd.daily21
1 files changed, 14 insertions, 7 deletions
diff --git a/main/sysklogd/sysklogd.daily b/main/sysklogd/sysklogd.daily
index ccd63d61e4..6c5692ba3d 100755
--- a/main/sysklogd/sysklogd.daily
+++ b/main/sysklogd/sysklogd.daily
@@ -10,8 +10,8 @@ CONF="/etc/syslog.conf"
syslogd_listfiles() {
# List the target files from syslog.conf
- local skip="auth"
- [ "$1" = "--auth" ] && skip=" "
+ local skip=
+ [ "$1" = "--auth" ] && skip="!"
# the while loop joins lines that end in "\"
# the sed (in order)-
@@ -19,14 +19,21 @@ syslogd_listfiles() {
# collapses spaces/tabs to 1 space;
# deletes the "-" in front of the filename;
# deletes whitespace before ';'
- # deletes lines that have the "skip" facility
+ # deletes lines that have/dont have the "auth" facility
# deletes the facility (leaving just the filename)
# deletes lines that are not filenames with leading "/"
+ # print it
while read a ; do echo "$a"; done < $CONF |\
- sed -n "/^[ \t]*#/D; /^[ \t]*$/D; s/[ \t]\+/ /g; \
- s+ -/+ /+g; s/ *; */;/; /^.*\($skip\)[^ ]* /D; \
- s/^[^ ]* //; /^[^\\/]/D; P" |\
- sort | uniq
+ sed -n -e "s/\#.*//" \
+ -e "/^\s*$/D" \
+ -e "s/\s\+/ /g" \
+ -e "s: -/: /:g" \
+ -e "s/ *; */;/" \
+ -e "/^.*\(auth\)[^ ]* /${skip}D" \
+ -e "s:^.* /:/:" \
+ -e "/^[^\\/]/D" \
+ -e "P" \
+ | sort | uniq
}
# dumb little savelog - no error checking here