--- src/logcheck.orig 2017-12-21 16:33:24 UTC +++ src/logcheck @@ -24,16 +24,16 @@ if [ `id -u` = 0 ]; then echo "logcheck should not be run as root. Use su to invoke logcheck:" - echo "su -s /bin/bash -c \"/usr/sbin/logcheck${@:+ $@}\" logcheck" + echo "su -m %%LOGCHECK_USER%% -c \"%%LOCALBASE%%/bin/bash %%PREFIX%%/sbin/logcheck${@:+ $@}\"" echo "Or use sudo: sudo -u logcheck logcheck${@:+ $@}." # you may want to uncomment that hack to let logcheck invoke itself. - # su -s /bin/bash -c "$0 $*" logcheck + # su -s %%LOCALBASE%%/bin/bash -c "$0 $*" logcheck exit 1 fi -if [ ! -f /usr/bin/lockfile-create -o \ - ! -f /usr/bin/lockfile-remove -o \ - ! -f /usr/bin/lockfile-touch ]; then +if [ ! -f %%PREFIX%%/bin/lockfile-create -o \ + ! -f %%PREFIX%%/bin/lockfile-remove -o \ + ! -f %%PREFIX%%/bin/lockfile-touch ]; then echo "fatal: lockfile-progs is a prerequisite for logcheck, and was not found." exit 1 fi @@ -69,13 +69,13 @@ EVENTSSUBJECT="System Events" ADDTAG="no" # Set the default paths -RULEDIR="/etc/logcheck" -CONFFILE="/etc/logcheck/logcheck.conf" -STATEDIR="/var/lib/logcheck" -LOGFILES_LIST="/etc/logcheck/logcheck.logfiles" -LOGFILES_LIST_D="/etc/logcheck/logcheck.logfiles.d" -LOGFILE_FALLBACK="/var/log/syslog" -LOGTAIL="/usr/sbin/logtail2" +RULEDIR="%%ETCDIR%%" +CONFFILE="%%ETCDIR%%/logcheck.conf" +STATEDIR="%%DBDIR%%" +LOGFILES_LIST="%%ETCDIR%%/logcheck.logfiles" +LOGFILES_LIST_D="%%ETCDIR%%/logcheck.logfiles.d" +LOGFILE_FALLBACK="/var/log/messages" +LOGTAIL="%%PREFIX%%/sbin/logtail2" CAT="/bin/cat" SYSLOG_SUMMARY="/usr/bin/syslog-summary" @@ -90,7 +90,7 @@ FQDN=0 SORTUNIQ=0 SUPPORT_CRACKING_IGNORE=0 SYSLOGSUMMARY=0 -LOCKDIR=/run/lock/logcheck +LOCKDIR=/var/run/logcheck LOCKFILE="$LOCKDIR/logcheck" # Carry out the clean up tasks @@ -171,7 +171,7 @@ $message ${TMPDIR:+Check temporary directory: $TMPDIR } Also verify that the logcheck user can read all files referenced in -/etc/logcheck/logcheck.logfiles! +%%ETCDIR%%/logcheck.logfiles! $(export) EOF @@ -223,7 +223,7 @@ cleanrules() { error "Couldn't read $x" fi done - for rulefile in $(run-parts --list "$dir"); do + for rulefile in $(ls -1R "$dir"); do rulefile="$(basename "$rulefile")" if [ -f "${dir}/${rulefile}" ]; then debug "cleanrules: ${dir}/${rulefile}" @@ -538,9 +538,9 @@ fi # Hostname either fully qualified or not. if [ "$FQDN" -eq 1 ]; then - HOSTNAME="$(hostname --fqdn 2>/dev/null)" + HOSTNAME="$(hostname -f 2>/dev/null)" else - HOSTNAME="$(hostname --short 2>/dev/null)" + HOSTNAME="$(hostname -s 2>/dev/null)" fi # Now check for the other options @@ -645,8 +645,8 @@ else fi # Create the secure temporary directory or exit -TMPDIR="$(mktemp -d -p "${TMP:-/tmp}" logcheck.XXXXXX)" \ - || TMPDIR="$(mktemp -d -p /var/tmp logcheck.XXXXXX)" \ +TMPDIR="$(mktemp -d ${TMP:-/tmp}/logcheck.XXXXXX)" \ + || TMPDIR="$(mktemp -d /var/tmp/logcheck.XXXXXX)" \ || error "Could not create temporary directory" # Now clean the rulefiles in the directories