rpms/dspam/EL-5 dspam-cron, NONE, 1.1 dspam-filter-requires.sh, NONE, 1.1 dspam-front, NONE, 1.1 dspam-init.d, NONE, 1.1 dspam-logrotate, NONE, 1.1 dspam-sysconfig, NONE, 1.1 dspam-web.conf, NONE, 1.1 dspam.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Nathanael Noblet gnat at fedoraproject.org
Sun Jan 24 21:28:00 UTC 2010


Author: gnat

Update of /cvs/pkgs/rpms/dspam/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20641/EL-5

Modified Files:
	.cvsignore sources 
Added Files:
	dspam-cron dspam-filter-requires.sh dspam-front dspam-init.d 
	dspam-logrotate dspam-sysconfig dspam-web.conf dspam.spec 
	import.log 
Log Message:
initial El-5 import



--- NEW FILE dspam-cron ---
#!/bin/sh
#
# $Id: dspam_maintenance.sh,v 1.07 2010/01/15 20:52:41 sbajic Exp $
#
# Copyright 2007-2010 Stevan Bajic <stevan at bajic.ch>
# Distributed under the terms of the GNU Affero General Public License v3
#
# Purpose: Remove old signatures and unimportant tokens from the DSPAM
#          database. Purge old log entries in user and system logs.
#
# Note   : I originally wrote that script for Gentoo Linux in 2007 and it
#          is since then distributed with the Gentoo DSPAM ebuild. This
#          edition here is slightly changed to be more flexible. I have
#          not tested that script on other distros except on Gentoo Linux
#          and on a older CentOS distro. Should you find any issues with
#          this script then please post a message on the DSPAM user
#          mailing list.
#
# Note   : This script can be called from the command line or run from
#          within cron. Either add a line in your crontab or add this
#          script in your cron.{hourly,daily,weekly,monthly}. Running
#          this script every hour might not be the best idea but it's
#          your decision if you want to do so.
###

MYSQL_BIN_DIR="/usr/bin"
PGSQL_BIN_DIR="/usr/bin"
SQLITE_BIN_DIR="/usr/bin"
SQLITE3_BIN_DIR="/usr/bin"
DSPAM_CONFIGDIR=""
DSPAM_HOMEDIR=""
DSPAM_BIN_DIR=""
DSPAM_PURGE_SCRIPT_DIR=""


#
# Parse optional command line parameters
#
for foo in $@
do
	case "${foo}" in
		--profile=*) PROFILE="${foo#--profile=}";;
		--logdays=*) LOGROTATE_AGE="${foo#--logdays=}";;
		--signatures=*) SIGNATURE_AGE="${foo#--signatures=}";;
		--neutral=*) NEUTRAL_AGE="${foo#--neutral=}";;
		--unused=*) UNUSED_AGE="${foo#--unused=}";;
		--hapaxes=*) HAPAXES_AGE="${foo#--hapaxes=}";;
		--hits1s=*) HITS1S_AGE="${foo#--hits1s=}";;
		--hits1i=*) HITS1I_AGE="${foo#--hits1i=}";;
		--purgescriptdir=*) DSPAM_PURGE_SCRIPT_DIR="${foo#--purgescriptdir=}";;
		--without-sql-purge) USE_SQL_PURGE="false";;
		--with-all-drivers) PURGE_ALL_DRIVERS="true";;
		--verbose) VERBOSE="true";;
		*)
			echo -ne "Usage: $0 \n\t[--profile=[PROFILE]]\n\t[--logdays=no_of_days]\n\t[--signatures=no_of_days]\n\t[--neutral=no_of_days]\n\t[--unused=no_of_days]\n\t[--hapaxes=no_of_days]\n\t[--hits1s=no_of_days]\n\t[--hits1i=no_of_days]\n\t[--without-sql-purge]\n\t[--purgescriptdir=[DIRECTORY]\n\t[--with-all-drivers]\n\t\[--verbose]\n"
			exit 1
			;;
	esac
done


#
# Function to run dspam_clean
#
run_dspam_clean() {
	[ "${VERBOSE}" = "true" ] && echo -ne "Running dspam_clean"
	local PURGE_SIG="${1}"
	local ADD_PARAMETER=""
	read_dspam_params DefaultProfile
	if [ -n "${PROFILE}" -a -n "${DefaultProfile}" -a "${PROFILE/*.}" != "${DefaultProfile}" ]
	then
		ADD_PARAMETER="--profile=${PROFILE/*.}"
	fi
	if [ "${PURGE_SIG}" = "YES" ]
	then
		echo " (with purging old signatures)"
		${DSPAM_BIN_DIR}/dspam_clean ${ADD_PARAMETER} -s${SIGNATURE_AGE} -p${NEUTRAL_AGE} -u${UNUSED_AGE},${HAPAXES_AGE},${HITS1S_AGE},${HITS1I_AGE} >/dev/null 2>&1
	else
		echo " (without purging old signatures)"
		${DSPAM_BIN_DIR}/dspam_clean ${ADD_PARAMETER} -p${NEUTRAL_AGE} -u${UNUSED_AGE},${HAPAXES_AGE},${HITS1S_AGE},${HITS1I_AGE} >/dev/null 2>&1
	fi
	return ${?}
}


#
# Function to check if we have all needed tools
#
check_for_tools() {
	local myrc=0
	for foo in awk cut sed sort strings grep
	do
		if ! which ${foo} >/dev/null 2>&1
		then
			echo "Command ${foo} not found!"
			myrc=1
		fi
	done
	return ${myrc}
}


#
# Function to read dspam.conf parameters
#
read_dspam_params() {
	local PARAMETER VALUE
	local INCLUDE_DIRS
	INCLUDE_DIRS=$(awk "BEGIN { IGNORECASE=1; } \$1==\"Include\" { print \$2 \"/*.conf\"; }" "${DSPAM_CONFIGDIR}/dspam.conf" 2>/dev/null)
	for PARAMETER in $@ ; do
		VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${DSPAM_CONFIGDIR}/dspam.conf" ${INCLUDE_DIRS[@]} 2>/dev/null)
		[ ${?} = 0 ] || return 1
		eval ${PARAMETER/.*}=\"${VALUE}\"
	done
	return 0
}


#
# Function to clean DSPAM MySQL data
#
clean_mysql_drv() {
	#
	# MySQL
	#
	[ "${VERBOSE}" = "true" ] && echo "Running MySQL storage driver data cleanup"
	if	[ "${USE_SQL_PURGE}" = "true" ] && \
		read_dspam_params MySQLServer${PROFILE} MySQLPort${PROFILE} MySQLUser${PROFILE} MySQLPass${PROFILE} MySQLDb${PROFILE} MySQLCompress${PROFILE} && \
		[ -n "${MySQLServer}" -a -n "${MySQLUser}" -a -n "${MySQLDb}" ]
	then
		if [ ! -e "${MYSQL_BIN_DIR}/mysql_config" ]
		then
			echo "Can not run MySQL purge script:"
			echo "  ${MYSQL_BIN_DIR}/mysql_config does not exist"
			return 1
		fi
		DSPAM_MySQL_PURGE_SQL=
		DSPAM_MySQL_PURGE_SQL_FILES=
		DSPAM_MySQL_VER=$(${MYSQL_BIN_DIR}/mysql_config --version | sed "s:[^0-9.]*::g")
		DSPAM_MySQL_MAJOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f1)
		DSPAM_MySQL_MINOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f2)
		DSPAM_MySQL_MICRO=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f3)
		DSPAM_MySQL_INT=$(($DSPAM_MySQL_MAJOR * 65536 + $DSPAM_MySQL_MINOR * 256 + $DSPAM_MySQL_MICRO))

		if [ "${DSPAM_MySQL_INT}" -ge "262400" ]
		then
			# For MySQL >= 4.1 use the new purge script
			# For the 4.1-optimized version see:
			# http://securitydot.net/txt/id/32/type/articles/
			# Version >= 3.9.0 of DSPAM do already include a better purge script.
			DSPAM_MySQL_PURGE_SQL_FILES="mysql_purge-4.1-optimized mysql_purge-4.1"
		else
			DSPAM_MySQL_PURGE_SQL_FILES="mysql_purge"

		fi

		#
		# We first search for the purge scripts in the directory the user has
		# told us to look for (command line option: --purgescriptdir
		# Then we look in DSPAM configuration directory under ./config/ and then
		# in the DSPAM configuration directory it self.
		#
		for foo in ${DSPAM_PURGE_SCRIPT_DIR} ${DSPAM_CONFIGDIR}/config ${DSPAM_CONFIGDIR}
		do
			for bar in ${DSPAM_MySQL_PURGE_SQL_FILES}
			do
				if [ -f "${foo}/${bar}.sql" ]
				then
					DSPAM_MySQL_PURGE_SQL="${foo}/${bar}.sql"
					break
				elif [ -f "${foo}/${bar/_//}.sql" ]
				then
					DSPAM_MySQL_PURGE_SQL="${foo}/${bar/_//}.sql"
					break
				fi
			done
			[ -n "${DSPAM_MySQL_PURGE_SQL}" ] && break
		done

		if [ -z "${DSPAM_MySQL_PURGE_SQL}" ]
		then
			echo "Can not run MySQL purge script:"
			echo "  No mysql_purge SQL script found"
			return 1
		fi

		if [ ! -r "${DSPAM_MySQL_PURGE_SQL}" ]
		then
			echo "Can not read MySQL purge script:"
			echo "  ${DSPAM_MySQL_PURGE_SQL}"
			return 1
		fi

		if [ ! -e "${MYSQL_BIN_DIR}/mysql" ]
		then
			echo "Can not run MySQL purge script:"
			echo "  ${MYSQL_BIN_DIR}/mysql does not exist"
			return 1
		fi

		# Construct mysql command line
		echo -e "[client]\npassword=${MySQLPass}\n">"${DSPAM_CRON_TMPFILE}"
		DSPAM_MySQL_CMD="${MYSQL_BIN_DIR}/mysql"
		DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --defaults-extra-file=${DSPAM_CRON_TMPFILE}"
		DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --silent"
		DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --user=${MySQLUser}"
		[ -S "${MySQLServer}" ] &&
			DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --socket=${MySQLServer}" ||
			DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --host=${MySQLServer}"
		[ -n "${MySQLPort}" ] &&
			DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --port=${MySQLPort}"
		[ "${MySQLCompress}" = "true" ] &&
			DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --compress"

		# Run the MySQL purge script
		${DSPAM_MySQL_CMD} ${MySQLDb} < ${DSPAM_MySQL_PURGE_SQL} >/dev/null
		_RC=${?}
		if [ ${_RC} != 0 ]
		then
			echo "MySQL purge script returned error code ${_RC}"
		fi
		echo "">"${DSPAM_CRON_TMPFILE}"

		return 0
	fi
}


#
# Function to clean DSPAM PostgreSQL data
#
clean_pgsql_drv() {
	#
	# PostgreSQL
	#
	[ "${VERBOSE}" = "true" ] && echo "Running PostgreSQL storage driver data cleanup"
	if	[ "${USE_SQL_PURGE}" = "true" ] && \
		read_dspam_params PgSQLServer${PROFILE} PgSQLPort${PROFILE} PgSQLUser${PROFILE} PgSQLPass${PROFILE} PgSQLDb${PROFILE} && \
		[ -n "${PgSQLServer}" -a -n "${PgSQLUser}" -a -n "${PgSQLDb}" ]
	then
		DSPAM_PgSQL_PURGE_SQL=
		DSPAM_PgSQL_PURGE_SQL_FILES="pgsql_pe-purge"

		#
		# We first search for the purge scripts in the directory the user has
		# told us to look for (command line option: --purgescriptdir
		# Then we look in DSPAM configuration directory under ./config/ and then
		# in the DSPAM configuration directory it self.
		#
		for foo in ${DSPAM_PURGE_SCRIPT_DIR} ${DSPAM_CONFIGDIR}/config ${DSPAM_CONFIGDIR}
		do
			for bar in ${DSPAM_PgSQL_PURGE_SQL_FILES}
			do
				if [ -f "${foo}/${bar}.sql" ]
				then
					DSPAM_PgSQL_PURGE_SQL="${foo}/${bar}.sql"
					break
				elif [ -f "${foo}/${bar/_//}.sql" ]
				then
					DSPAM_PgSQL_PURGE_SQL="${foo}/${bar/_//}.sql"
					break
				fi
			done
			[ -n "${DSPAM_PgSQL_PURGE_SQL}" ] && break
		done

		if [ -z "${DSPAM_PgSQL_PURGE_SQL}" ]
		then
			echo "Can not run PostgreSQL purge script:"
			echo "  No pgsql_purge SQL script found"
			return 1
		fi

		if [ ! -r "${DSPAM_PgSQL_PURGE_SQL}" ]
		then
			echo "Can not read PostgreSQL purge script:"
			echo "  ${DSPAM_PgSQL_PURGE_SQL}"
			return 1
		fi

		if [ ! -e "${PGSQL_BIN_DIR}/psql" ]
		then
			echo "Can not run PostgreSQL purge script:"
			echo "  ${PGSQL_BIN_DIR}/psql does not exist"
			return 1
		fi

		# Construct psql command line
		echo "*:*:${PgSQLDb}:${PgSQLUser}:${PgSQLPass}">"${DSPAM_CRON_TMPFILE}"
		DSPAM_PgSQL_CMD="${PGSQL_BIN_DIR}/psql -q -U ${PgSQLUser} -h ${PgSQLServer} -d ${PgSQLDb}"
		[ -n "${PgSQLPort}" ] &&
			DSPAM_PgSQL_CMD="${DSPAM_PgSQL_CMD} -p ${PgSQLPort}"

		# Run the PostgreSQL purge script
		PGPASSFILE="${DSPAM_CRON_TMPFILE}" ${DSPAM_PgSQL_CMD} -f "${DSPAM_PgSQL_PURGE_SQL}" >/dev/null
		_RC=${?}
		if [ ${_RC} != 0 ]
		then
			echo "PostgreSQL purge script returned error code ${_RC}"
		fi
		echo "">"${DSPAM_CRON_TMPFILE}"

		return 0
	fi
}


#
# Function to clean DSPAM Hash data
#
clean_hash_drv() {
	#
	# Hash
	#
	[ "${VERBOSE}" = "true" ] && echo "Running Hash storage driver data cleanup"
	if [ -d "${DSPAM_HOMEDIR}/data" ]
	then
		if [ -e ${DSPAM_BIN_DIR}/cssclean ]
		then
			find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type f -name "*.css" | while read name
			do
				${DSPAM_BIN_DIR}/cssclean "${name}" 1>/dev/null 2>&1
			done
		else
			echo "DSPAM cssclean binary not found!"
		fi
		find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type d -name "*.sig" | while read name
		do
			find "${name}" -maxdepth 1 -mindepth 1 -type f -mtime +${SIGNATURE_AGE} -name "*.sig" -exec /bin/rm "{}" ";"
		done
		return 0
	else
		return 1
	fi
}


#
# Function to clean DSPAM SQLite3 data
#
clean_sqlite3_drv() {
	#
	# SQLite3
	#
	[ "${VERBOSE}" = "true" ] && echo "Running SQLite v3 storage driver data cleanup"
	if	[ "${USE_SQL_PURGE}" = "true" ]
	then
		DSPAM_SQLite3_PURGE_SQL=""
		[ -f "${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql"
		[ -f "${DSPAM_CONFIGDIR}/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite3_purge.sql"

		if [ -z "${DSPAM_SQLite3_PURGE_SQL}" ]
		then
			echo "Can not run SQLite3 purge script:"
			echo "  No sqlite_purge SQL script found"
			return 1
		fi

		if [ ! -e "${SQLITE3_BIN_DIR}/sqlite3" ]
		then
			echo "Can not run SQLite3 purge script:"
			echo "  ${SQLITE3_BIN_DIR}/sqlite3 does not exist"
			return 1
		fi

		# Run the SQLite3 purge script and vacuum
		find "${DSPAM_HOMEDIR}" -name "*.sdb" -print | while read name
		do
			${SQLITE3_BIN_DIR}/sqlite3 "${name}" < "${DSPAM_SQLite3_PURGE_SQL}" >/dev/null
			# Enable the next line if you don't vacuum in the purge script
			# echo "vacuum;" | ${SQLITE3_BIN_DIR}/sqlite3 "${name}" >/dev/null
		done 1>/dev/null 2>&1
		return 0
	fi

}


#
# Function to clean DSPAM SQLite < 3.0 data
#
clean_sqlite_drv() {
	#
	# SQLite
	#
	[ "${VERBOSE}" = "true" ] && echo "Running SQLite v2 storage driver data cleanup"
	if	[ "${USE_SQL_PURGE}" = "true" ]
	then
		DSPAM_SQLite_PURGE_SQL=""
		[ -f "${DSPAM_CONFIGDIR}/config/sqlite_purge.sql" ] && DSPAM_SQLite_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite_purge.sql"
		[ -f "${DSPAM_CONFIGDIR}/sqlite_purge.sql" ] && DSPAM_SQLite_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite_purge.sql"

		if [ -z "${DSPAM_SQLite_PURGE_SQL}" ]
		then
			echo "Can not run SQLite purge script:"
			echo "  No sqlite_purge SQL script found"
			return 1
		fi

		if [ ! -e "${SQLITE_BIN_DIR}/sqlite" ]
		then
			echo "Can not run SQLite purge script:"
			echo "  ${SQLITE_BIN_DIR}/sqlite does not exist"
			return 1
		fi

		# Run the SQLite purge script and vacuum
		find "${DSPAM_HOMEDIR}" -name "*.sdb" -print | while read name
		do
			${SQLITE_BIN_DIR}/sqlite "${name}" < "${DSPAM_SQLite_PURGE_SQL}" >/dev/null
			# Enable the next line if you don't vacuum in the purge script
			# echo "vacuum;" | ${SQLITE_BIN_DIR}/sqlite "${name}" >/dev/null
		done 1>/dev/null 2>&1
		return 0
	fi

}


#
# Use a lock file to prevent multiple runs at the same time
#
DSPAM_CRON_LOCKFILE="/var/run/$(basename $0 .sh).pid"


#
# File used to save temporary data
#
DSPAM_CRON_TMPFILE="/tmp/.ds_$$"


#
# Kill process if lockfile is older or equal 12 hours
#
if [ -f ${DSPAM_CRON_LOCKFILE} ]; then
	DSPAM_REMOVE_CRON_LOCKFILE="YES"
	for foo in $(cat ${DSPAM_CRON_LOCKFILE} 2>/dev/null); do
		if [ -L "/proc/${foo}/exe" -a "$(readlink -f /proc/${foo}/exe)" = "$(readlink -f /proc/$$/exe)" ]; then
			DSPAM_REMOVE_CRON_LOCKFILE="NO"
		fi
	done
	if [ "${DSPAM_REMOVE_CRON_LOCKFILE}" = "YES" ]; then
		rm -f ${DSPAM_CRON_LOCKFILE} >/dev/null 2>&1
	elif [ $(($(date +%s)-$(stat --printf="%X" ${DSPAM_CRON_LOCKFILE}))) -ge $((12*60*60)) ]; then
		for foo in $(cat ${DSPAM_CRON_LOCKFILE} 2>/dev/null); do
			if [ -L "/proc/${foo}/exe" -a "$(readlink -f /proc/${foo}/exe)" = "$(readlink -f /proc/$$/exe)" ]; then
				kill -s KILL ${foo} >/dev/null 2>&1
			fi
		done
		DSPAM_REMOVE_CRON_LOCKFILE="YES"
		for foo in $(cat ${DSPAM_CRON_LOCKFILE} 2>/dev/null); do
			if [ -L "/proc/${foo}/exe" -a "$(readlink -f /proc/${foo}/exe)" = "$(readlink -f /proc/$$/exe)" ]; then
				DSPAM_REMOVE_CRON_LOCKFILE="NO"
			fi
		done
		if [ "${DSPAM_REMOVE_CRON_LOCKFILE}" = "YES" ]; then
			rm -f ${DSPAM_CRON_LOCKFILE} >/dev/null 2>&1
		fi
	fi
fi


#
# Acquire lock file and start processing
#
if ( set -o noclobber; echo "$$" > "${DSPAM_CRON_LOCKFILE}") 2> /dev/null; then

	trap 'rm -f "${DSPAM_CRON_LOCKFILE}" "${DSPAM_CRON_TMPFILE}"; exit ${?}' INT TERM EXIT


	#
	# Create the temporary file
	#
	UMASK_OLD="$(umask)"
	umask 077
	[ -e "${DSPAM_CRON_TMPFILE}" ] && /bin/rm -f "${DSPAM_CRON_TMPFILE}" >/dev/null 2>&1
	touch "${DSPAM_CRON_TMPFILE}"
	umask "${UMASK_OLD}"


	#
	# Check for needed tools
	#
	if ! check_for_tools
	then
		# We have not all needed tools installed. Run just the dspam_clean part.
		run_dspam_clean
		exit ${?}
	fi


	#
	# Try to read most of the configuration options from DSPAM
	#
	DSPAM_CONFIG_PARAMETERS=$(dspam --version 2>&1 | sed -n "s:^Configuration parameters\:[\t ]*\(.*\)$:\1:gI;s:' '\-\-:\n--:g;s:^'::g;s:' '[a-zA-Z].*::gp")
	if [ -z "${DSPAM_CONFIG_PARAMETERS}" ]
	then
		# Not good! dspam --version does not print out configuration parameters.
		# Try getting the information by parsing the strings in the DSPAM binary.
		DSPAM_CONFIG_PARAMETERS=$(strings $(whereis dspam | awk '{print $2}') 2>&1 | sed -n "/'\-\-[^']*'[\t ]*'\-\-[^']*'/p" 2>/dev/null | sed -n "s:' '\-\-:\n--:g;s:^[\t ]*'::g;s:' '[a-zA-Z].*::gp")
	fi
	if [ -n "${DSPAM_CONFIG_PARAMETERS}" ]
	then
		for foo in ${DSPAM_CONFIG_PARAMETERS}
		do
			case "${foo}" in
				--sysconfdir=*)
					DSPAM_CONFIGDIR="${foo#--sysconfdir=}"
					;;
				--with-dspam-home=*)
					DSPAM_HOMEDIR="${foo#--with-dspam-home=}"
					;;
				--prefix=*)
					DSPAM_BIN_DIR="${foo#--prefix=}"/bin
					;;
				--with-storage-driver=*)
					STORAGE_DRIVERS="${foo#--with-storage-driver=}"
					STORAGE_DRIVERS=($(echo ${STORAGE_DRIVERS} | sed "s:,:\n:g" | sort -u))
					;;
			esac
		done
		[ "${VERBOSE}" = "true" -a -n "${STORAGE_DRIVERS}" ] && echo "Enabled drivers are: ${STORAGE_DRIVERS[@]}"
	else
		echo "Warning: dspam --version does not print configuration parameters!"
	fi


	#
	# Try to get DSPAM bin directory
	#
	if [ -z "${DSPAM_BIN_DIR}" ]
	then
		if [ -e /usr/bin/dspam -a -e /usr/bin/dspam_clean ]
		then
			DSPAM_BIN_DIR="/usr/bin"
		else
			echo "DSPAM binary directory not found!"
			exit 2
		fi
	fi
	if [ ! -e "${DSPAM_BIN_DIR}/dspam" -o ! -e "${DSPAM_BIN_DIR}/dspam_clean" ]
	then
		echo "Binary for dspam and/or dspam_clean not found! Can not continue without it."
		exit 2
	fi


	#
	# Try to get DSPAM config directory
	#
	if [ -z "${DSPAM_CONFIGDIR}" ]
	then
		if [ -f /etc/mail/dspam/dspam.conf ]
		then
			DSPAM_CONFIGDIR="/etc/mail/dspam"
		elif [ -f /etc/dspam/dspam.conf ]
		then
			DSPAM_CONFIGDIR="/etc/dspam"
		else
			echo "Configuration directory not found!"
			exit 2
		fi
	fi
	if [ ! -f "${DSPAM_CONFIGDIR}/dspam.conf" ]
	then
		echo "dspam.conf not found! Can not continue without it."
		exit 2
	fi


	#
	# Parameters
	#
	if [ -z "${PROFILE}" ]
	then
		if read_dspam_params DefaultProfile && [ -n "${DefaultProfile}" ]
		then
			PROFILE=.${DefaultProfile}
		fi
	else
		PROFILE=.${PROFILE}
	fi
	[ -z "${LOGROTATE_AGE}" ] && LOGROTATE_AGE=15			# System and user log
	[ -z "${USE_SQL_PURGE}" ] && USE_SQL_PURGE="true"		# Run SQL purge scripts
	[ -z "${PURGE_ALL_DRIVERS}" ] && PURGE_ALL_DRIVERS="false"	# Only purge active driver
	[ -z "${VERBOSE}" ] && VERBOSE="false"				# No additional output
	if [ -z "${SIGNATURE_AGE}" ]
	then
		if read_dspam_params PurgeSignatures && [ -n "${PurgeSignatures}" -a "${PurgeSignatures}" != "off" ]
		then
			SIGNATURE_AGE=${PurgeSignatures}
		else
			SIGNATURE_AGE=14		# Stale signatures
		fi
	fi
	if [ -z "${NEUTRAL_AGE}" ]
	then
		if read_dspam_params PurgeNeutral && [ -n "${PurgeNeutral}" -a "${PurgeNeutral}" != "off" ]
		then
			NEUTRAL_AGE=${PurgeNeutral}
		else
			NEUTRAL_AGE=90			# Tokens with neutralish probabilities
		fi
	fi
	if [ -z "${UNUSED_AGE}" ]
	then
		if read_dspam_params PurgeUnused && [ -n "${PurgeUnused}" -a "${PurgeUnused}" != "off" ]
		then
			UNUSED_AGE=${PurgeUnused}
		else
			UNUSED_AGE=90			# Unused tokens
		fi
	fi
	if [ -z "${HAPAXES_AGE}" ]
	then
		if read_dspam_params PurgeHapaxes && [ -n "${PurgeHapaxes}" -a "${PurgeHapaxes}" != "off" ]
		then
			HAPAXES_AGE=${PurgeHapaxes}
		else
			HAPAXES_AGE=30			# Tokens with less than 5 hits (hapaxes)
		fi
	fi
	if [ -z "${HITS1S_AGE}" ]
	then
		if read_dspam_params PurgeHits1S && [ -n "${PurgeHits1S}" -a "${PurgeHits1S}" != "off" ]
		then
			HITS1S_AGE=${PurgeHits1S}
		else
			HITS1S_AGE=15			# Tokens with only 1 spam hit
		fi
	fi
	if [ -z "${HITS1I_AGE}" ]
	then
		if read_dspam_params PurgeHits1I && [ -n "${PurgeHits1I}" -a "${PurgeHits1I}" != "off" ]
		then
			HITS1I_AGE=${PurgeHits1I}
		else
			HITS1I_AGE=15			# Tokens with only 1 innocent hit
		fi
	fi


	#
	# Try to get DSPAM data home directory
	#
	if read_dspam_params Home && [ -d "${Home}" ]
	then
		DSPAM_HOMEDIR=${Home}
	else
		# Something is wrong in dspam.conf! Check if /var/spool/dspam exists instead.
		if [ -z "${DSPAM_HOMEDIR}" -a -d /var/spool/dspam ]
		then
			DSPAM_HOMEDIR="/var/spool/dspam"
		fi
	fi
	if [ ! -d "${DSPAM_HOMEDIR}" -o -z "${DSPAM_HOMEDIR}" ]
	then
		echo "Home directory not found! Please fix your dspam.conf."
		exit 2
	fi


	#
	# System and user log purging
	#
	if [ ! -e "${DSPAM_BIN_DIR}/dspam_logrotate" ]
	then
		echo "dspam_logrotate not found! Can not continue without it."
		exit 2
	fi
	[ "${VERBOSE}" = "true" ] && echo "Running dspam_logrotate"
	${DSPAM_BIN_DIR}/dspam_logrotate -a ${LOGROTATE_AGE} -d "${DSPAM_HOMEDIR}" >/dev/null &


	#
	# Don't purge signatures with dspam_clean if we purged them with SQL
	#
	RUN_FULL_DSPAM_CLEAN="NO"


	#
	# Currently active storage driver
	#
	ACTIVE_DRIVER=""
	if [ ${#STORAGE_DRIVERS[@]} -eq 1 ]
	then
		ACTIVE_DRIVER="${STORAGE_DRIVERS[0]}"
	else
		read_dspam_params StorageDriver
		if [ -n "${StorageDriver}" ]
		then
			for foo in hash_drv mysql_drv pgsql_drv sqlite3_drv sqlite_drv
			do
				if ( echo "${StorageDriver}" | grep -q "${foo}" )
				then
					ACTIVE_DRIVER="${foo}"
					break
				fi
			done
		fi
	fi
	[ "${VERBOSE}" = "true" -a -n "${ACTIVE_DRIVER}" ] && echo "Active driver is: ${ACTIVE_DRIVER}"


	#
	# Which drivers to process/purge
	#
	if [ "${PURGE_ALL_DRIVERS}" = "false" -a -n "${ACTIVE_DRIVER}" ]
	then
		DRIVERS_TO_PROCESS=${ACTIVE_DRIVER}
	elif [ ${#STORAGE_DRIVERS[@]} -gt 0 ]
	then
		DRIVERS_TO_PROCESS=${STORAGE_DRIVERS[@]}
	else
		echo "Warning: Could not get a list of supported storage drivers!"
		echo "Warning: Could not determine the currently active storage driver!"
		DRIVERS_TO_PROCESS=""
		RUN_FULL_DSPAM_CLEAN="YES"
	fi


	#
	# Process selected storage drivers
	#
	for foo in ${DRIVERS_TO_PROCESS}
	do
		case "${foo}" in
			hash_drv)
				clean_hash_drv
				;;
			mysql_drv)
				clean_mysql_drv
				;;
			pgsql_drv)
				clean_pgsql_drv
				;;
			sqlite3_drv)
				clean_sqlite3_drv
				;;
			sqlite_drv)
				clean_sqlite_drv
				;;
			*)
				RUN_FULL_DSPAM_CLEAN="YES"
				echo "Unknown storage ${foo} driver"
				;;
		esac
	done


	#
	# Run the dspam_clean command
	#
	# NOTE:	The hash driver does not work with dspam_clean. So under no
	#	circumstances do run dspam_clean if the hash driver is the
	#	ONLY or the currently used driver!
	if [ -n "${ACTIVE_DRIVER}" ]
	then
		if [ "${ACTIVE_DRIVER}" = "hash_drv" ]
		then
			echo "Hash storage driver detected (not running dspam_clean)"
		else
			run_dspam_clean ${RUN_FULL_DSPAM_CLEAN}
		fi
	else
		# Storage driver probably statically linked. Not running dspam_clean
		# because of potential risk that the storage driver used is the Hash
		# driver.
		echo "Could not detect current storage driver (not running dspam_clean)"
	fi


	#
	# Release lock and delete temp file
	#
	/bin/rm -f "${DSPAM_CRON_LOCKFILE}"
	/bin/rm -f "${DSPAM_CRON_TMPFILE}"
	trap - INT TERM EXIT
fi


--- NEW FILE dspam-filter-requires.sh ---
#!/bin/sh
/usr/lib/rpm/perl.req $* |
sed -e '/perl(configure.pl)/d'


--- NEW FILE dspam-front ---
#!/bin/sh

/usr/bin/dspam $@
RETVAL=$?
if [ $RETVAL -ne 0 ];
then
        exit 75;
else
        exit $RETVAL;
fi



--- NEW FILE dspam-init.d ---
#!/bin/sh
#
# dspam:        Starts DSPAM in daemon mode
#
# Written by Stevan Bajic <stevan at bajic.ch>.
#
# chkconfig:    - 70 30
# description:  DSPAM (De-Spam) is a scalable, open-source statistical
#               anti-spam filter that provides high levels of accuracy with minimal
#               resources.
# processname:  dspam
# pidfile:      /var/run/dspam/dspam.pid


# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source config
if [ -f /etc/sysconfig/dspam ] ; then
    . /etc/sysconfig/dspam
else
    DSPAM_BIN="/usr/bin/dspam"
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

RETVAL=0
prog="dspam"

start() {
    echo -n $"Starting $prog: "
    if [ -f /var/lock/subsys/dspam ]; then
        RETVAL=0
    else
        ${DSPAM_BIN} --daemon  2>/dev/null&
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            echo_success
        else
            echo_failure
        fi
    fi
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dspam
    return $RETVAL
}

stop() {
    echo -n $"Stopping $prog: "
    killproc dspam
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dspam
    return $RETVAL
}

reload() {
    echo -n $"Reloading $prog configuration: "
    killproc dspam -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $prog
        ;;
    reload)
        reload
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        [ -f /var/lock/subsys/dspam ] && stop && start || :
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        ;;
    esac
exit $RETVAL


--- NEW FILE dspam-logrotate ---
# Copyright 2007 Stevan Bajic <stevan at bajic.ch>
# Distributed under the terms of the GNU General Public License v3
#
# Logrotate old DSPAM logs.
#

tabooext + .gz

# Rotate the bigger files daily or when they reach 10MB
/var/log/dspam/dspam.messages /var/log/dspam/sql.errors /var/log/dspam/dspam.debug /var/log/dspam/bnr.log {
	create
	notifempty
	nomail
	noolddir
	missingok
	daily
	size 10M
	compress
	create 0644 dspam mail
}


--- NEW FILE dspam-sysconfig ---
# Location of dspam binary
DSPAM_BIN="/usr/bin/dspam"

--- NEW FILE dspam-web.conf ---
#
# Web-UI for DSPAM.
#
Alias /dspam /usr/share/dspam-web
<Directory "/usr/share/dspam-web">
    DirectoryIndex      dspam.cgi
    AllowOverride       None
    Options             ExecCGI
    Order               allow,deny
    Allow               from all
    AuthType            Basic
    AuthName            "DSPAM WebUI login"
    Require             valid-user
    #AuthUserFile       /path/to/dspam-htpasswd
</Directory>

--- NEW FILE dspam.spec ---
%global dspam_user      dspam
%global dspam_group     mail
%global dspam_homedir   %{_localstatedir}/lib/dspam
%global dspam_confdir   %{_sysconfdir}
%global dspam_logdir    %{_localstatedir}/log/dspam
%global dspam_mode      2511
%global __perl_requires %{SOURCE99}

Summary:                A library and Mail Delivery Agent for Bayesian SPAM filtering
Name:                   dspam
Version:                3.9.0
Release:                3%{?dist}
License:                GPLv2
Group:                  System Environment/Daemons
Source0:                http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1:                dspam-init.d
Source2:                dspam-cron
Source3:                dspam-logrotate
Source4:                dspam-web.conf
Source5:                dspam-front
Source6:                dspam-sysconfig
Source99:               dspam-filter-requires.sh
URL:                    http://www.nuclearelephant.com/
# kept to be able to build EPEL versions
Buildroot:              %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:          autoconf 
BuildRequires:          automake
BuildRequires:          libtool
BuildRequires:          mysql-devel
BuildRequires:          postgresql-devel
BuildRequires:          sqlite-devel
BuildRequires:          openldap-devel

Requires:               dspam-libs = %{version}-%{release}
Requires(post):         chkconfig
Requires(preun):        chkconfig
Requires(preun):        initscripts

%description
The DSPAM agent masquerades as the email server's local delivery agent
and filters/learns spams using an advanced Bayesian statistical approach
(based on Baye's theorem of combined probabilities) which provides an
administratively maintenance-free, easy-learning Anti-Spam service
custom tailored to each individual user's behavior. Advanced because on
top of standard Bayesian filtering is also incorporated the use of
Chained Tokens, de-obfuscation, and other enhancements. DSPAM works
great with Sendmail, Exim and Postfix, and should work well with any
other MTA that supports an external local delivery agent (qmail, etc.)

%package libs
Summary:                The DSPAM library core processing engines
Group:                  System Environment/Libraries

%description libs
The DSPAM core processing engine, also known as libdspam, provides all
critical spam filtering functions.  The engine is embedded into other
DSPAM components (such as the agent) and is responsbile for the actual
filtering logic.

%package client
Summary:                The DSPAM client program used to talk to dspam daemon
Group:                  Applications/System

%description client
The DSPAM client program communicates with a server to process emails.

%package hash
Summary:                Hash storage driver for libdspam
Group:                  System Environment/Libraries
Requires:               dspam-libs = %{version}-%{release}

%description hash
The self-contained Hash-Based driver (inspired by Bill Yerazunis' CRM
Sparse Spectra algorithm) is the fastest solution by far and requires no
dependencies, supports an auto-extend feature to grow the file size as
needed, and is very fast and compact. It does, however, lack some
features (such as merged groups support) and uses a lot of memory to
mmap() users. The driver is thread-safe (required for running DSPAM in
server daemon mode).

%package mysql
Summary:                MySQL storage driver for libdspam
Group:                  System Environment/Libraries
Requires:               dspam-libs = %{version}-%{release}

%description mysql
MySQL driver for libdspam. The driver is thread-safe (required for
running DSPAM in server daemon mode).

%package pgsql
Summary:                PostgreSQL storage driver for libdspam
Group:                  System Environment/Libraries
Requires:               dspam-libs = %{version}-%{release}

%description pgsql
PostgreSQL storage driver for libdspam. The driver is thread-safe
(required for running DSPAM in server daemon mode).

%package sqlite3
Summary:                SQLite v3.x storage driver for libdspam
Group:                  System Environment/Libraries
Requires:               dspam-libs = %{version}-%{release}

%description sqlite3
SQLite v3 storage driver for libdspam. The driver is not thread-safe
and should not be used in DSPAM server daemon mode.

%package devel
Summary:                Development library and header files for libdspam
Group:                  Development/Libraries
Requires:               dspam-libs = %{version}-%{release}

%description devel
DSPAM has had its core engine moved into a separate library, libdspam.
This library can be used by developers to provide 'drop-in' spam
filtering for their mail client applications, other Anti-Spam tools, or
similar projects.

%package web
Summary:                Web-based interface for DSPAM
Group:                  System Environment/Daemons
Requires:               dspam = %{version}-%{release}
Requires:               webserver

%description web
Web-based interface for DSPAM's powerful Anti-Spam engine.

%prep

%setup -q

%build
sh ./autogen.sh

%configure \
    --enable-long-usernames \
    --enable-syslog \
    --enable-large-scale \
    --disable-domain-scale \
    --disable-homedir \
    --enable-virtual-users \
    --enable-preferences-extension \
    --with-mysql-includes='%{_includedir}/mysql' \
    --with-mysql-libraries='%{_libdir}/mysql' \
    --with-pgsql-includes='%{_includedir}/pgsql' \
    --with-pgsql-libraries='%{_libdir}' \
    --enable-daemon \
    --enable-external-lookup \
    --with-storage-driver='hash_drv,mysql_drv,pgsql_drv,sqlite3_drv' \
    --with-dspam-home='%{dspam_homedir}' \
    --with-dspam-owner='%{dspam_user}' \
    --with-dspam-group='%{dspam_group}' \
    --with-dspam-home-group='%{dspam_group}' \
    --with-dspam-mode='%{dspam_mode}' \
    --with-logdir='%{dspam_logdir}' \
    --sysconfdir='%{dspam_confdir}'

%{__make} OPTIMIZE="%{optflags} -fPIC -DPIC"

%install
%{__rm} -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

# make some dirs
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/opt-in/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/opt-out/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/data/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_logdir}/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_var}/run/dspam/
%{__install}  -Dp -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/dspam-front

# webui
 %{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_datadir}/dspam-web/templates/
for foo in webui/cgi-bin/templates/??
do
    [ -d "${foo}" ] && %{__install} -d p -m 755 $RPM_BUILD_ROOT%{_datadir}/dspam-web/templates/${foo##*\/}
done

# remove .la and .a files
find $RPM_BUILD_ROOT -name *.la -exec rm {} \; 
find $RPM_BUILD_ROOT -name *.a  -exec rm {} \;

# move storage drivers (if they should be in the wrong directory by accident)
[ -f "$RPM_BUILD_ROOT%{_libdir}/lib*_drv*" ] && \
    %{__mv} -f $RPM_BUILD_ROOT%{_libdir}/lib*_drv* $RPM_BUILD_ROOT/%{_libdir}/dspam

# storage related configuration and scripts

# mysql
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/mysql
%{__install} -Dp -m 644 src/tools.mysql_drv/*.sql $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/mysql/

# postgres
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/pgsql
%{__install} -Dp -m 644 src/tools.pgsql_drv/*.sql $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/pgsql/

# sqlite 3
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/sqlite3
%{__install} -m 644 src/tools.sqlite_drv/purge-3.sql $RPM_BUILD_ROOT%{_datadir}/%{name}/sql-scripts/sqlite3/

# install text notifications
%{__install} -d -p $RPM_BUILD_ROOT%{dspam_homedir}/txt/
%{__install} -Dp -m 644 txt/*.txt $RPM_BUILD_ROOT%{dspam_homedir}/txt/
echo "Scanned and tagged as SPAM with DSPAM %{version} by Your ISP.com"> $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.spam
echo "Scanned and tagged as non-SPAM with DSPAM %{version} by Your ISP.com"> $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.nonspam

# install init.d script
%{__install} -Dp -m0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/dspam

# install cron script
%{__install} -Dp -m0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/dspam

# install logrotate script
%{__install} -Dp -m0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dspam

# install sysconfig script
%{__install} -Dp -m0755 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/dspam

# install devel files
%{__install} -Dp -m 0644 src/*.h $RPM_BUILD_ROOT%{_includedir}/dspam/

# when only one storage driver is compiled, it is linked statically with DSPAM
%{__sed} -i -e "s:^[\t ]\(StorageDriver[\t ]\{1,99\}.*\)$:# \1:" src/dspam.conf

# install additional copy of dspam.conf as reference
%{__install} -m0644 src/dspam.conf $RPM_BUILD_ROOT%{dspam_confdir}/dspam.conf.default

#make sure CHANGELOG is in utf-8 format
iconv -f iso8859-1 -t utf-8 CHANGELOG > CHANGELOG.conv && mv -f CHANGELOG.conv CHANGELOG

# web 
%{__install} -Dp -m0644 webui/htdocs/*.{css,gif} $RPM_BUILD_ROOT%{_datadir}/%{name}-web/
%{__install} -Dp -m0644 webui/cgi-bin/templates/*.html $RPM_BUILD_ROOT%{_datadir}/%{name}-web/templates
%{__install} -Dp -m0755 webui/cgi-bin/templates/*.pl $RPM_BUILD_ROOT%{_datadir}/%{name}-web/templates
%{__install} -Dp -m0644 webui/cgi-bin/{admins,default.prefs,rgb.txt} $RPM_BUILD_ROOT%{_datadir}/%{name}-web/

# setup configure.pl to by default expect the url to be /dspam so css and images load
%{__sed} -i -r -e '/CONFIG.*WEB_ROOT/s,"","/dspam",' webui/cgi-bin/configure.pl
%{__install} -Dp -m0755 webui/cgi-bin/{configure.pl,*.cgi} $RPM_BUILD_ROOT%{_datadir}/%{name}-web/

for foo in webui/cgi-bin/templates/??
do
    if [ -d "${foo}" ]
    then
        %{__install} -Dp -m0644 ${foo}/*.html $RPM_BUILD_ROOT%{_datadir}/%{name}-web/templates/${foo##*\/}
        [ -f ${foo}/*.pl ] && %{__install} -Dp -m0644 ${foo}/*.pl $RPM_BUILD_ROOT%{_datadir}/%{name}-web/templates/${foo##*\/}
    fi
done
%{__install} -Dp -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/

%post
/sbin/chkconfig --add %{name}

%preun
if [ $1 -eq 0 ]; then
    /sbin/service %{name} stop &>/dev/null || :
    /sbin/chkconfig --del %{name}
fi

%postun
if [ $1 -ge 1 ]; then
    /sbin/service %{name} condrestart &>/dev/null || :
fi

%pre libs
getent passwd %{dspam_user} >/dev/null || useradd -r -g %{dspam_group} -d %{dspam_homedir} -s /sbin/nologin -c 'User to own dspam directories and default processes' %{dspam_user}
exit 0

%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc README CHANGELOG RELEASE.NOTES UPGRADING
%attr(0770,%{dspam_user},%{dspam_group}) %dir %{dspam_logdir}
%attr(0770,%{dspam_user},%{dspam_group}) %dir %{dspam_homedir}
%dir %{dspam_homedir}/opt-in
%dir %{dspam_homedir}/opt-out
%attr(-,%{dspam_user},%{dspam_group}) %dir %{dspam_homedir}/data
%dir %{dspam_homedir}/txt/
%config(noreplace) %{dspam_homedir}/txt/*
%attr(0770,%{dspam_user},%{dspam_group}) %dir %{_var}/run/dspam
%{_sysconfdir}/cron.daily/dspam
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/dspam
%config(noreplace) %{_sysconfdir}/logrotate.d/dspam
%attr(0640,root,%{dspam_group}) %config(noreplace) %{dspam_confdir}/dspam.conf
%attr(0644,root,%{dspam_group}) %config(noreplace) %{dspam_confdir}/dspam.conf.default
%{_initrddir}/dspam
%{_mandir}/man1/*
%attr(%{dspam_mode},%{dspam_user},%{dspam_group}) %{_bindir}/dspam
%{_bindir}/dspam_2sql
%{_bindir}/dspam_admin
%{_bindir}/dspam_clean
%{_bindir}/dspam_crc
%{_bindir}/dspam_dump
%{_bindir}/dspam_logrotate
%{_bindir}/dspam_merge
%{_bindir}/dspam_stats
%{_bindir}/dspam_train
%{_bindir}/dspam-front

%files client
%defattr(-, root,root,-)
%{_bindir}/dspamc

%files libs
%defattr(-,root,root,-)
%doc README CHANGELOG RELEASE.NOTES UPGRADING LICENSE
%doc doc/{courier.txt,exim.txt,markov.txt,osx.txt,pop3filter.txt,postfix.txt,qmail.txt,relay.txt,sendmail.txt,tests.txt}
%{_libdir}/libdspam.so.*
%dir %{_libdir}/dspam
%dir %{_datadir}/%{name}/
%dir %{_datadir}/%{name}/sql-scripts

%files hash
%defattr(-,root,root,-)
%doc README.cssclean
%{_libdir}/dspam/libhash_drv.so*
%{_bindir}/css*

%files mysql
%defattr(-,root,root,-)
%doc doc/mysql_drv.txt
%{_datadir}/%{name}/sql-scripts/mysql/
%{_libdir}/dspam/libmysql_drv.so*

%files pgsql
%defattr(-,root,root,-)
%doc doc/pgsql_drv.txt
%{_datadir}/%{name}/sql-scripts/pgsql/
%{_libdir}/dspam/libpgsql_drv.so*
%{_bindir}/dspam_pg2int8

%files sqlite3
%defattr(-,root,root,-)
%doc doc/sqlite_drv.txt
%{_datadir}/%{name}/sql-scripts/sqlite3/
%{_libdir}/dspam/libsqlite3_drv.so*

%files devel
%defattr(-,root,root,-)
%{_libdir}/libdspam.so
%doc src/example.c
%dir %{_includedir}/dspam/
%{_includedir}/dspam/*
%{_libdir}/pkgconfig/dspam.pc
%{_mandir}/man3/*

%files web
%defattr(-,root,root,-)
%{_datadir}/dspam-web/
%config(noreplace) %{_sysconfdir}/httpd/conf.d/dspam-web.conf

%changelog
* Fri Jan 22 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-3
- Fixed missing source file affecting dspam daemon service

* Thu Jan 21 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-2
- Replaced last etc with _sysconfdir macro
- Use single integer release version
- Fixed dspam-web.conf to actually work by default when installed.
- Updated configure.pl to point to the proper directory
- Placed the relevant README's in both -libs and the main package as they are relevant for both

* Wed Jan 20 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-1.3
- Fixed web comments
- Replaced usr/share with macro
- Moved dspam-front back to the server portion where it belongs
- Changed directory name from dspam-webui to dspam-web
- Updated dspam-web.conf to point to proper paths
- Added external dependency script to filter out wrong perl deps

* Mon Jan 18 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-1.2
- Updated dspam-cron to not run dspam_clean if the hash driver is configured

* Fri Jan 15 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-1.1
- Remove world readable perms on /etc/dspam.conf
- Re-enabled dspam-web as the required dependancies exist
- Added -client package
- Created /etc/sysconfig/dspam file and modified initscript to use it by default

* Wed Jan 13 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-1
- Upstream release

* Tue Jan 12 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.19.RC2
- Added dist tag
- Removed check for ServerPID in initscript as it is unecessary
- Fixed permissions/ownership on /var/run/dspam

* Tue Jan 12 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.18.RC2
- Removed user(dspam) requirement left behind
- Fixed directory permissions and ownership for some missing directories

* Mon Jan 11 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.17.RC2
- Updated method of creating users via Packaging/UsersAndGroups

* Sat Jan 9 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.16.RC2
- Created system user dspam via PackageUserRegistry instructions
- Updated logrotate to use proper user and group
- Updated dspam-cron with paths to sql-scripts directory and whitespace changes
- Removed no longer necessary README.fedora

* Fri Jan 8 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.15.RC2
- Added README.cssclean to dspam-hash
- Fixed logrotate script using non-existant dspam user
- Removed logrotate rotating system.log as that is handled by dspam-cron
- Cleaned up package -n naming
- Corrected dspam, and other directory permissions to nobody:mail
- Moved css* to dspam-hash as they are only needed with that driver
- removed nonsense configure parameter enabling and disabling syslog

* Thu Jan 7 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.14.RC2
- Updated cron script
- Added README.fedora for fedora specific configuration information

* Wed Jan 6 2010 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.13.RC2
- Updated cron script
- Added dspam-front script that will return a proper error code to avoid bounces
- Fixed ownership issues of /var/lib/dspam/txt
- Checked ownership/permissions of sql scripts
- Don't compress sql purge scripts

* Fri Dec 18 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.12.RC2
- Bumped upstream version
- Fixed requirements to be dspam-libs instead of libdspam

* Mon Dec 7 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.11.BETA4
- Renamed libdspam to dspam-libs
- Moved docs to -libs package
- Added LICENSE file
- Fixed some directory ownership issues

* Sun Nov 29 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.10.BETA4
- Change dspam init to not be enabled by default
- Add EVR dependancy from all sub packages
- Removed pkgconfig requirement
- package -n dspam-web renamed to package web
- Updated perl requires even though dspam-web is not being built currently
- Added post/preun requirements to chkconfig and initscripts
- Updated defattr lines
- use _initrddir instead of _sysconfdir/rc.d/init.d (RHEL compat)
- updated source file permissions
- get libdspam to own the sql-scripts directory

* Wed Nov 25 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.9.BETA4
- Modified the line removing .la and .a files

* Thu Nov 19 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.8.BETA4
- Restored css* binaries they are hash driver utilities

* Thu Nov 19 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.7.BETA4
- Changed BuildRoot definition
- Don't test for buildroot in install section
- Remove setgid on dspamc
- Removed css* binaries

* Thu Nov 19 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.6.BETA4
- Use install -Dp -m instead of pre-creating the directories
- Move dspam-webui.conf to Source4
- Removed some of the autoX calls

* Wed Nov 18 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.5.BETA4
- Cleanup Requires
- Stop building web ui as some perl dependancies are unmet
- Fixed Source0 url

* Wed Nov 18 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.4.BETA4
- Remove build conditionals

* Mon Nov 16 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.3.BETA4
- Revise permission on /etc/dspam.conf and /var/lib/dspam
- Remove compression on documentation
- Move driver documentation to subpackages
- Remove sqlite_drv.txt if neither sqlite driver is being built
- Remove .la and .a files
- Disable install-strip for the debuginfo package

* Sun Nov 15 2009 Stevan Bajic <stevan at bajic.ch> - 3.9.0-0.2.BETA4
- Splitting into libdspam package and driver package
- Moving static libs and libtool archives into libdspam-devel package
- Enabling build of single storage driver statically linked into DSPAM
- Enabling build of single storage driver as dynamically loaded module
- Compressing SQL files and documentation
- Added version tag to change log
- Renamed cron and logrotate scripts to follow Fedora packing guidelines
- Added post/postun for libdspam and all libdspam storage drivers
- Replaced all tabs with softtabs (don't know if this is needed but Nathanael had it that way)
- Enabled install-strip
- Extended package description

* Sat Nov 14 2009 Nathanael Noblet <nathanael at gnat.ca> - 3.9.0-0.1.BETA4
- General cleanups as required by Fedora packaging guidlines

* Sat Nov 14 2009 Stevan Bajic <stevan at bajic.ch> - 3.9.0-BETA4
- DSPAM 3.9.0-BETA4

* Wed Dec 26 2007 Stevan Bajic <stevan at bajic.ch> - 3.8.0
- Avoid using the %%exclude macro as it looks like
  FC6 does not like this command and RPM < 4.0.3
  anyway does not support %%exclude.

* Sun Dec 23 2007 Stevan Bajic <stevan at bajic.ch> - 3.8.0
- Make Tony Earnshaw happy :)

* Sat Dec 22 2007 Stevan Bajic <stevan at bajic.ch> - 3.8.0
- Added newest Gentoo patch set

* Tue Apr 17 2007 Stevan Bajic <stevan at bajic.ch> - 3.8.0
- Initial relase


--- NEW FILE import.log ---
dspam-3_9_0-3_fc12:EL-5:dspam-3.9.0-3.fc12.src.rpm:1264368453


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dspam/EL-5/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- .cvsignore	24 Jan 2010 17:28:51 -0000	1.1
+++ .cvsignore	24 Jan 2010 21:27:59 -0000	1.2
@@ -0,0 +1 @@
+dspam-3.9.0.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dspam/EL-5/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- sources	24 Jan 2010 17:28:51 -0000	1.1
+++ sources	24 Jan 2010 21:27:59 -0000	1.2
@@ -0,0 +1 @@
+10d092b57d628d8c91655fee5dc0d0cd  dspam-3.9.0.tar.gz



More information about the scm-commits mailing list