Detect logrotate not installed in /usr/sbin

Gentoo started installing the logrotate binary to bin, see
gentoo/gentoo@bc23def39c
and https://bugs.gentoo.org/show_bug.cgi?id=588156
There might be other systems doing that, which makes it a good idea
to stop hardcoding the path.

fixes #12535

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This commit is contained in:
Louis Sautier 2016-08-23 00:59:24 +02:00 committed by Gunnar Beutner
parent 429d11daa8
commit e725e6719c
1 changed files with 2 additions and 1 deletions

View File

@ -99,7 +99,8 @@ endif()
if(NOT DEFINED LOGROTATE_HAS_SU)
set(LOGROTATE_HAS_SU OFF)
execute_process(COMMAND "/usr/sbin/logrotate" ERROR_VARIABLE LOGROTATE_OUTPUT)
find_program(LOGROTATE_BINARY logrotate)
execute_process(COMMAND ${LOGROTATE_BINARY} ERROR_VARIABLE LOGROTATE_OUTPUT)
if(LOGROTATE_OUTPUT)
string(REGEX REPLACE "^logrotate ([0-9.]*).*" "\\1" LOGROTATE_VERSION
${LOGROTATE_OUTPUT})