head	1.3;
access;
symbols
	RELEASE_8_0_0:1.2
	RELEASE_7_2_0:1.2
	RELEASE_7_1_0:1.2
	RELEASE_6_4_0:1.2;
locks; strict;
comment	@# @;


1.3
date	2009.12.18.01.31.19;	author glarkin;	state dead;
branches;
next	1.2;

1.2
date	2008.09.11.00.30.09;	author glarkin;	state Exp;
branches;
next	1.1;

1.1
date	2008.09.07.01.31.56;	author glarkin;	state Exp;
branches;
next	;


desc
@@


1.3
log
@- Parameterized all non-hier(7)-compliant paths in the logcheck script,
  man page and config files, adding support for a custom PREFIX setting.
- Parameterized the shebang line in the logtail script
- Bumped PORTREVISION

PR:		ports/140981
Submitted by:	Dan Langille <dan@@langille.org>
@
text
@--- ./src/logcheck.orig	2007-01-16 01:13:27.000000000 -0500
+++ ./src/logcheck	2008-09-09 18:10:02.000000000 -0400
@@@@ -1,4 +1,4 @@@@
-#!/bin/bash
+#!/usr/local/bin/bash
 #
 # Copyright (C) 2004-2006 Debian Logcheck Team 
 #                         <logcheck-devel@@alioth.lists.debian.org>
@@@@ -26,17 +26,10 @@@@
 
 if [ $UID == 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 -c \"/usr/local/bin/bash /usr/local/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
-    exit 1
-fi
-
-if [ ! -f /usr/bin/lockfile-create -o \
-     ! -f /usr/bin/lockfile-remove -o \
-     ! -f /usr/bin/lockfile-touch ]; then
-    echo "fatal: lockfile-progs is a prerequisite for logcheck, and was not found."
+    # su -s /usr/local/bin/bash -c "$0 $*" logcheck
     exit 1
 fi
 
@@@@ -68,12 +61,12 @@@@
 ADDTAG="no"
 
 # Set the default paths
-RULEDIR="/etc/logcheck"
-CONFFILE="/etc/logcheck/logcheck.conf"
-STATEDIR="/var/lib/logcheck"
-LOGFILES_LIST="/etc/logcheck/logcheck.logfiles"
-LOGFILE_FALLBACK="/var/log/syslog"
-LOGTAIL="/usr/sbin/logtail"
+RULEDIR="/usr/local/etc/logcheck"
+CONFFILE="/usr/local/etc/logcheck/logcheck.conf"
+STATEDIR="/var/db/logcheck"
+LOGFILES_LIST="/usr/local/etc/logcheck/logcheck.logfiles"
+LOGFILE_FALLBACK="/var/log/messages"
+LOGTAIL="/usr/local/sbin/logtail"
 CAT="/bin/cat"
 SYSLOG_SUMMARY="/usr/bin/syslog-summary"
 
@@@@ -87,26 +80,21 @@@@
 SORTUNIQ=0
 SUPPORT_CRACKING_IGNORE=0
 SYSLOGSUMMARY=0
-LOCKDIR=/var/lock/logcheck
+LOCKDIR=/var/run/logcheck
 LOCKFILE="$LOCKDIR/logcheck"
 
 # Carry out the clean up tasks
 cleanup() {
 
-    if [ -n "$LOCK" ]; then
-        debug "cleanup: Killing lockfile-touch - $LOCK"
-	kill $LOCK && unset LOCK
-    fi
-
-    if [ -f "$LOCKFILE.lock" ]; then
-        debug "cleanup: Removing lockfile: $LOCKFILE.lock"
-	lockfile-remove $LOCKFILE
+    if [ -f "$LOCKFILE" ]; then
+        debug "cleanup: Removing lockfile: $LOCKFILE"
+	rm -f $LOCKFILE
     fi
 
     if [ -d $TMPDIR ]; then
         # Remove the tmp directory
         if [ $NOCLEANUP -eq 0 ];then 
-    	    cd /var/lib/logcheck
+    	    cd /var/db/logcheck
     	    debug "cleanup: Removing - $TMPDIR" 
     	    rm -r $TMPDIR
         else
@@@@ -142,14 +130,9 @@@@
     if [ "$2" = "noclean" ]; then
 	debug "error: Not removing lockfile"
     else
-        if [ -n "$LOCK" ]; then
-	    debug "error: Killing lockfile-touch - $LOCK"
-	    kill $LOCK && unset LOCK
-	fi
-
-       if [ -f "$LOCKFILE.lock" ]; then
-           debug "error: Removing lockfile: $LOCKFILE.lock"
-           lockfile-remove $LOCKFILE
+       if [ -f "$LOCKFILE" ]; then
+           debug "error: Removing lockfile: $LOCKFILE"
+           rm -f $LOCKFILE
        fi
 	
     fi
@@@@ -212,8 +195,7 @@@@
 	    mkdir $cleaned \
 	        || error "Could not make dir $cleaned for cleaned rulefiles."
 	fi
-	for rulefile in $(run-parts --list $dir); do
-	    rulefile=$(basename $rulefile)
+	for rulefile in $(ls -1R $dir); do
 	    if [ -f ${dir}/${rulefile} ]; then
 		debug "cleanrules: ${dir}/${rulefile}"
 		if [ -r ${dir}/${rulefile} ]; then
@@@@ -544,9 +526,9 @@@@
 
 # Hostname either fully qualified or not.
 if [ $FQDN -eq 1 ]; then
-        HOSTNAME="$(hostname --fqdn)" > /dev/null 2>&1
+        HOSTNAME="$(hostname -f)" > /dev/null 2>&1
 else
-        HOSTNAME="$(hostname --short)" > /dev/null 2>&1
+        HOSTNAME="$(hostname -s)" > /dev/null 2>&1
 fi
 		
 # Now check for the other options
@@@@ -625,25 +607,21 @@@@
 
 trap 'cleanup' 0
 
-debug "Trying to get lockfile: $LOCKFILE.lock"
+debug "Trying to get lockfile: $LOCKFILE"
 if [ ! -d $LOCKDIR ]; then 
 	mkdir -m 0755 $LOCKDIR
 fi
-lockfile-create --retry 1 $LOCKFILE > /dev/null 2>&1
+lockfile -r 1 $LOCKFILE > /dev/null 2>&1
 
 
 if [ $? -eq 1 ]; then 
     trap 0
-    error "Failed to get lockfile: $LOCKFILE.lock" "noclean"
-else 
-    debug "Running lockfile-touch $LOCKFILE.lock"
-    lockfile-touch $LOCKFILE &
-    LOCK="$!"
+    error "Failed to get lockfile: $LOCKFILE" "noclean"
 fi
 
 # Create the secure temporary directory or exit
-TMPDIR=$(mktemp -d -p /tmp logcheck.XXXXXX) \
-    || TMPDIR=$(mktemp -d -p /var/tmp logcheck.XXXXXX) \
+TMPDIR=$(mktemp -d /tmp/logcheck.XXXXXX) \
+    || TMPDIR=$(mktemp -d /var/tmp/logcheck.XXXXXX) \
     || error "Could not create temporary directory"
 
 # Now clean the rulefiles in the directories
@


1.2
log
@- Fixed logcheck script silent failure in previous commit
- Added handling for crontab installation problems
- Incorported security fixes from PR opened after previous commit
- Added UPDATING entry since configuration options have changed
  fairly significantly

PR:		ports/122842
Submitted by:	Cezary Morga <cm@@therek.net>
PR:		ports/127255
Submitted by:	Yasuhiro KIMURA <yasu at utahime dot org>
Reviewed by:	glarkin
Approved by:	beech (mentor, implicit)
Approved by:	portmgr (marcus)
Security:	Incorrect addition of logcheck user to wheel group
@
text
@@


1.1
log
@- Updated to 1.2.54
- Replaced hard-coded paths in pkg-plist with variables
- Cleaned up installation commands
- Moved crontab file to EXAMPLESDIR and updated pkg-install.in
  to handle port knob NOPORTEXAMPLES
- Regenerated patch files with "make makepatch"

PR:		ports/122842
Submitted by:	Cezary Morga <cm at therek dot net>
Approved by:	beech (mentor, implicit)
@
text
@d2 1
a2 1
+++ ./src/logcheck	2008-09-06 19:11:28.000000000 -0400
d14 1
a14 1
+    echo "su logcheck -c \"/usr/local/bin/bash /usr/local/sbin/logcheck${@@:+ $@@}\""
d35 1
a35 3
+RULEDIR="/usr/local/etc/logcheck"
+CONFFILE="/usr/local/etc/logcheck/logcheck.conf"
 STATEDIR="/var/lib/logcheck"
d39 3
d48 1
a48 1
@@@@ -87,20 +80,15 @@@@
d73 7
@

