Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
logrotate: use "su" keyword only if available
Newer version of logrotate (>= 3.7 or 3.8, depending on the distribution)
the "su" directive is required.
Unfortunally, older version do not know about this keyword.
With this patch configure detects, if "su" is a valid keyword in a
logrotate configuration file.

Fixes #537: usage of too-new "su" in logrotate file
  • Loading branch information
joergsteffens authored and Marco van Wieringen committed Oct 19, 2015
1 parent fa879c5 commit 223144c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions autoconf/configure.in
Expand Up @@ -1918,6 +1918,22 @@ AC_ARG_WITH(sbin-perm,

AC_SUBST(SBINPERM)

dnl -------------------------------------------
dnl logrotate: has "su" option?
dnl -------------------------------------------
AC_PATH_PROG(LOGROTATE, logrotate, [], [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
logrotate_su=""
if test "x$LOGROTATE" != "x" -a "x$dir_user" != "x" -a "x$dir_group" != "x"; then
echo -e "/tmp/dummy.log {\n su root root\n}" > logrotate-test-su.conf
if $LOGROTATE -d logrotate-test-su.conf 2>&1 | grep "unknown option 'su'" >/dev/null; then
logrotate_su=""
else
logrotate_su="su ${dir_user} ${dir_group}"
fi
rm logrotate-test-su.conf
fi
AC_SUBST(logrotate_su)

dnl -------------------------------------------
dnl NDMP (default off)
dnl -------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion scripts/logrotate.in
Expand Up @@ -11,5 +11,5 @@
rotate 6
notifempty
missingok
su bareos bareos
@logrotate_su@
}

0 comments on commit 223144c

Please sign in to comment.