# # # $Id: indimail.spec.in,v 1.42 2020-06-02 22:38:20+05:30 Cprogrammer Exp mbhangui $ %undefine _missing_build_ids_terminate_build %global _unpackaged_files_terminate_build 1 %if %{defined _project} # define if building on openSUSE build service %global build_on_obs 1 %global reconfigure_mode 0 %global reconf_bogofilter 0 %global build_cflags "-DOBS_BUILD %{build_cflags}" %else %define _project local %global build_on_obs 0 %global reconfigure_mode 0 %global reconf_bogofilter 0 %global _hardened_build 1 %endif %if %{defined nodebug} %global debug_package %{nil} %endif %global _prefix /usr %global servicedir /service %global sysconfdir /etc/indimail %global libexecdir %{_prefix}/libexec/indimail %global shareddir %{_prefix}/share/indimail %global mandir %{_prefix}/share/man %global url https://github.com/mbhangui/indimail-virtualdomains %if %build_on_obs == 1 %global packager Manvendra Bhangui > %endif Summary: Fast anti-spam filtering by Bayesian statistical analysis Name: indimail-spamfilter Version: 1.0.0 Release: 1.1%{?dist} %if %build_on_obs == 1 License: GPL-3.0+ %else License: GPLv3 %endif %if %{undefined suse_version} && %{undefined sles_version} Group: System Environment/Base %else Group: Productivity/Networking/Email/Servers %endif Source0: http://downloads.sourceforge.net/indimail/%{name}-%{version}.tar.gz Source1: http://downloads.sourceforge.net/indimail/%{name}-rpmlintrc %if 0%{?suse_version} >= 1120 Source2: http://downloads.sourceforge.net/indimail/%{name}-permissions.easy Source3: http://downloads.sourceforge.net/indimail/%{name}-permissions.secure Source4: http://downloads.sourceforge.net/indimail/%{name}-permissions.paranoid %endif URL: https://github.com/mbhangui/indimail-virtualdomains AutoReqProv: Yes BuildRequires: rpm gcc gcc-c++ make coreutils grep BuildRequires: glibc glibc-devel BuildRequires: gzip autoconf automake libtool BuildRequires: sed findutils gsl-devel BuildRequires: flex bison %if 0%{?suse_version} BuildRequires: db-devel %else %if 0%{?fedora_version} > 30 || 0%{?centos_version} > 600 || 0%{?rhel_version} > 600 || 0%{?centos_ver} > 6 || 0%{?scientificlinux_version} > 600 || 0%{?almalinux_version} > 700 || 0%{?rocky_version} > 700 || 0%{?fedora} > 30 || 0%{?rhel} > 7 || %{defined amzn} || %{defined mgaversion} || %{defined openEuler} BuildRequires: libdb-devel %else BuildRequires: db4-devel %endif %endif %if %{undefined nodebug} BuildRequires: chrpath %endif %if 0%{?suse_version} >= 1120 Requires: permissions %endif ################################# OBS ############################### %if %build_on_obs == 1 %if 0%{?suse_version} BuildRequires: -post-build-checks #!BuildIgnore: post-build-checks #!BuildIgnore: brp-check-suse %endif %endif ################################# OBS ############################### %if 0%{?suse_version} Requires: glibc-locale-base %endif Requires: procps /usr/bin/awk /usr/bin/which Requires: sed findutils Requires: coreutils grep /bin/sh glibc Requires: indimail-mta Conflicts: indimail < 3.2 %description Bogofilter is a Bayesian spam filter. In its normal mode of operation, it takes an email message or other text on standard input, does a statistical check against lists of "good" and "bad" words, and returns a status code indicating whether or not the message is spam. Bogofilter is designed with fast algorithms (including Berkeley DB system), coded directly in C, and tuned for speed, so it can be used for production by sites that process a lot of mail. This version substantially improves on Paul's proposal by doing smarter lexical analysis. In particular, hostnames and IP addresses are retained as recognition features rather than broken up. Various kinds of MTA cruft such as dates and message-IDs are discarded so as not to bloat the word lists. %prep %setup -q %build ( echo "---------------- INFORMATION ------------------------" echo target %_target echo target_alias %_target_alias echo target_cpu %_target_cpu echo target_os %_target_os echo target_vendor %_target_vendor echo Building %{name}-%{version}-%{release} Build %{_build} OS %{_os} echo "------------------------------------------------------" ) > %{name}-rpm.info ( echo "NAME=%{name}" echo "Description=\"IndiMail Spamfilter Package\"" echo "SPAMFILTER_version="%{version}"" echo "ID=%{name}" echo "HOME_URL=\"https://github.com/mbhangui/indimail-virtualdomains\"" echo "PACKAGE_BUGREPORT=\"'Manvendra Bhangui '\"" ) > %{name}-release #### bogofilter ###################### if [ %{reconf_bogofilter} -eq 1 ] ; then echo "reconfiguring..." %{__mkdir_p} m4 aclocal -I m4 autoreconf -fiv fi ( HOME='.';export HOME %if %{defined mgaversion} || %{defined suse_version} %configure --prefix=%{_prefix} --libexecdir=%{libexecdir} \ --sysconfdir=%{sysconfdir} --mandir=%{mandir} \ --datarootdir=%{shareddir} --enable-indimail \ --with-charset=utf-8 %else %configure --prefix=%{_prefix} --libexecdir=%{libexecdir} \ --sysconfdir=%{sysconfdir} --mandir=%{mandir} \ --datarootdir=%{shareddir} --enable-indimail %endif ) %install %{__make} -s %{?_smp_mflags} %if %{defined nodebug} %{__make} -s %{?_smp_mflags} DESTDIR=%{buildroot} install-strip %else %{__make} -s %{?_smp_mflags} DESTDIR=%{buildroot} install %endif %{__mkdir_p} %{buildroot}%{sysconfdir} %if 0%{?suse_version} >= 1120 %{__mkdir_p} %{buildroot}%{_sysconfdir}/permissions.d/ install -m 644 %{S:2} %{buildroot}%{_sysconfdir}/permissions.d/%{name}-permissions install -m 644 %{S:3} %{buildroot}%{_sysconfdir}/permissions.d/%{name}-permissions.secure %endif install -m 0644 %{name}-rpm.info %{buildroot}%{sysconfdir}/%{name}-rpm.info install -m 0644 %{name}-release %{buildroot}%{sysconfdir}/%{name}-release /bin/rm -f %{name}-rpm.info %{name}-release # if we are building with debug package %if %{undefined nodebug} for i in bogofilter bogoutil bogotune do if [ -x /usr/bin/chrpath ] ; then /usr/bin/chrpath -d %{buildroot}%{_prefix}/bin/$i fi /bin/chmod 755 %{buildroot}%{_prefix}/bin/$i done %endif if [ -x /bin/touch ] ; then TOUCH=/bin/touch elif [ -x /usr/bin/touch ] ; then TOUCH=/usr/bin/touch else TOUCH=/bin/touch fi %if %{undefined suse_version} && %{undefined sles_version} $TOUCH %{buildroot}%{sysconfdir}/bogofilter.cf %endif %files %defattr(-, root, root,-) # # Directories # %if "%{mandir}" != "/usr/share/man" %dir %attr(755,root,root) %{mandir} %dir %attr(755,root,root) %{mandir}/man1 %endif %attr(644,root,root) %{sysconfdir}/%{name}-release %attr(644,root,root) %{sysconfdir}/%{name}-rpm.info %attr(644,root,root) %config(noreplace) %{sysconfdir}/bogofilter.perms %ghost %config(noreplace,missingok) %{sysconfdir}/bogofilter.cf %attr(644,root,root) %{sysconfdir}/bogofilter.cf.example %if 0%{?suse_version} >= 1120 %attr(644,root,root) %config(noreplace) %{_sysconfdir}/permissions.d/%{name}-permissions %attr(644,root,root) %config(noreplace) %{_sysconfdir}/permissions.d/%{name}-permissions.secure %endif # bogofilter # setuid binary %if 0%{?suse_version} >= 1120 %verify (not user group mode caps) %attr(6511, root, indimail) %{_prefix}/bin/bogofilter %else %attr(6511,root,indimail) %{_prefix}/bin/bogofilter %endif %attr(755,root,root) %{_prefix}/bin/bogolexer %attr(755,root,root) %{_prefix}/bin/bogotune %attr(755,root,root) %{_prefix}/bin/bogoutil %attr(755,root,root) %{_prefix}/bin/bogoupgrade %attr(755,root,root) %{_prefix}/sbin/bf_compact %attr(755,root,root) %{_prefix}/sbin/bf_copy %attr(755,root,root) %{_prefix}/sbin/bf_tar %docdir %{shareddir}/doc %docdir %{mandir} %attr(644,root,root) %{mandir}/man1/* %if %build_on_obs == 0 %license %attr(644,root,root) %{shareddir}/doc/COPYING.bogofilter %else %attr(644,root,root) %{shareddir}/doc/COPYING.bogofilter %endif %attr(644,root,root) %{shareddir}/doc/AUTHORS.bogofilter %attr(644,root,root) %{shareddir}/doc/HOWTO.bogofilter %clean %if %{undefined nodebug} %{__rm} -f %{_builddir}/debugfiles.list %{_builddir}/debuglinks.list \ %{_builddir}/debugsourcefiles.list %{_builddir}/debugsources.list \ %{_builddir}/elfbins.list %endif ### SCRIPTLET ############################################################################### %verifyscript %if 0%{?suse_version} >= 1120 %verify_permissions -e %{_prefix}/bin/bogofilter %endif ### SCRIPTLET ############################################################################### %post argv1=$1 if [ -x /bin/touch ] ; then TOUCH=/bin/touch elif [ -x /usr/bin/touch ] ; then TOUCH=/usr/bin/touch else TOUCH=/bin/touch fi if [ -z "$argv1" ] ; then argv1=0 fi if [ $argv1 -eq 2 ] ; then # upgrade # we are doing upgrade exit 0 fi if [ -d /run ] ; then logfifo="/run/indimail/logfifo" %{__mkdir_p} /run/indimail elif [ -d /var/run ] ; then logfifo="/var/run/indimail/logfifo" %{__mkdir_p} /var/run/indimail else logfifo="/tmp/logfifo" fi %if 0%{?suse_version} >= 1120 %if 0%{?set_permissions:1} > 0 %set_permissions %{_prefix}/bin/bogofilter %else %run_permissions %endif %endif # SMTP # Configure SPAMFILTER, LOGFILTER for port in 465 25 do if [ ! -d %{servicedir}/qmail-smtpd.$port ] ; then continue fi if [ -f %{servicedir}/qmail-smtpd.$port/variables/QMAILQUEUE ] ; then %{__mv} %{servicedir}/qmail-smtpd.$port/variables/QMAILQUEUE \ %{servicedir}/qmail-smtpd.$port/variables/SPAMQUEUE if [ $? -eq 0 ] ; then echo "%{_prefix}/sbin/qmail-spamfilter" > %{servicedir}/qmail-smtpd.$port/variables/QMAILQUEUE fi fi # update SPAMFILTER and also change .options, so that refreshsvc doesn't lose the settings if [ ! -f %{servicedir}/qmail-smtpd.$port/variables/SPAMFILTER ] ; then echo "%{_prefix}/bin/bogofilter -p -d %{sysconfdir}" > %{servicedir}/qmail-smtpd.$port/variables/SPAMFILTER elif [ ! -s %{servicedir}/qmail-smtpd.$port/variables/SPAMFILTER ] ; then echo "%{_prefix}/bin/bogofilter -p -d %{sysconfdir}" > %{servicedir}/qmail-smtpd.$port/variables/SPAMFILTER fi if [ ! -f %{servicedir}/qmail-smtpd.$port/variables/SPAMEXITCODE ] ; then echo 0 > %{servicedir}/qmail-smtpd.$port/variables/SPAMEXITCODE fi if [ ! -f %{servicedir}/qmail-smtpd.$port/variables/REJECTSPAM ] ; then echo 0 > %{servicedir}/qmail-smtpd.$port/variables/REJECTSPAM fi if [ ! -f %{servicedir}/qmail-smtpd.$port/variables/MAKESEEKABLE ] ; then echo 1 > %{servicedir}/qmail-smtpd.$port/variables/MAKE_SEEKABLE elif [ ! -s %{servicedir}/qmail-smtpd.$port/variables/MAKESEEKABLE ] ; then echo 1 > %{servicedir}/qmail-smtpd.$port/variables/MAKE_SEEKABLE fi if [ ! -f %{servicedir}/qmail-smtpd.$port/variables/LOGFILTER ] ; then echo $logfifo > %{servicedir}/qmail-smtpd.$port/variables/LOGFILTER fi grep bogofilter %{servicedir}/qmail-smtpd.$port/variables/.options > /dev/null 2>&1 if [ $? -ne 0 ] ; then options="`cat %{servicedir}/qmail-smtpd.$port/variables/.options`" options="$options --spamfilter=\"%{_prefix}/bin/bogofilter -p -d %{sysconfdir}\"" options="$options --logfilter=\"$logfifo\" --rejectspam=\"0\" --spamexitcode=\"0\"" if [ -f %{servicedir}/qmail-smtpd.$port/variables/.options ] ; then %{__cp} %{servicedir}/qmail-smtpd.$port/variables/.options \ %{servicedir}/qmail-smtpd.$port/variables/.options.nospamfilter fi echo $options > %{servicedir}/qmail-smtpd.$port/variables/.options fi done if [ -d %{servicedir}/fetchmail ] ; then if [ -f %{servicedir}/fetchmail/variables/QMAILQUEUE ] ; then %{__mv} %{servicedir}/fetchmail/variables/QMAILQUEUE \ %{servicedir}/fetchmail/variables/SPAMQUEUE if [ $? -eq 0 ] ; then echo "%{_prefix}/sbin/qmail-spamfilter" > %{servicedir}/fetchmail/variables/QMAILQUEUE fi fi # update SPAMFILTER and also change .options, so that refreshsvc doesn't lose the settings if [ ! -f %{servicedir}/fetchmail/variables/SPAMFILTER ] ; then echo "%{_prefix}/bin/bogofilter -p -d %{sysconfdir}" > %{servicedir}/fetchmail/variables/SPAMFILTER elif [ ! -s %{servicedir}/fetchmail/variables/SPAMFILTER ] ; then echo "%{_prefix}/bin/bogofilter -p -d %{sysconfdir}" > %{servicedir}/fetchmail/variables/SPAMFILTER fi if [ ! -f %{servicedir}/fetchmail/variables/SPAMEXITCODE ] ; then echo 0 > %{servicedir}/fetchmail/variables/SPAMEXITCODE fi if [ ! -f %{servicedir}/fetchmail/variables/REJECTSPAM ] ; then echo 0 > %{servicedir}/fetchmail/variables/REJECTSPAM fi if [ ! -f %{servicedir}/fetchmail/variables/MAKESEEKABLE ] ; then echo 1 > %{servicedir}/fetchmail/variables/MAKE_SEEKABLE elif [ ! -s %{servicedir}/fetchmail/variables/MAKESEEKABLE ] ; then echo 1 > %{servicedir}/fetchmail/variables/MAKE_SEEKABLE fi if [ ! -f %{servicedir}/fetchmail/variables/LOGFILTER ] ; then echo $logfifo > %{servicedir}/fetchmail/variables/LOGFILTER fi grep bogofilter %{servicedir}/fetchmail/variables/.options > /dev/null 2>&1 if [ $? -ne 0 ] ; then options="`cat %{servicedir}/fetchmail/variables/.options`" options="$options --spamfilter=\"%{_prefix}/bin/bogofilter -p -d %{sysconfdir}\"" options="$options --logfilter=\"$logfifo\" --rejectspam=\"0\" --spamexitcode=\"0\"" if [ -f %{servicedir}/fetchmail/variables/.options ] ; then %{__mv} %{servicedir}/fetchmail/variables/.options \ %{servicedir}/fetchmail/variables/.options.nospamfilter fi echo $options > %{servicedir}/fetchmail/variables/.options fi fi # # bogofilter configuration # if [ -d %{sysconfdir} ] ; then if [ -x %{_prefix}/sbin/svctool ] ; then %{_prefix}/sbin/svctool --config=bogofilter fi fi ### SCRIPTLET ############################################################################### %postun argv1=$1 if [ -z "$argv1" ] ; then argv1=0 fi for dir in fetchmail qmail-smtpd.465 qmail-smtpd.25 do > %{servicedir}/$dir/variables/SPAMFILTER > %{servicedir}/$dir/variables/SPAMEXITCODE > %{servicedir}/$dir/variables/REJECTSPAM > %{servicedir}/$dir/variables/LOGFILTER if [ -f %{servicedir}/$dir/variables/.options.nospamfilter ] ; then %{__mv} %{servicedir}/$dir/variables/.options.nospamfilter \ %{servicedir}/$dir/variables/.options fi if [ -f %{servicedir}/$dir/variables/SPAMQUEUE ] ; then %{__mv} %{servicedir}/$dir/variables/SPAMQUEUE \ %{servicedir}/$dir/variables/QMAILQUEUE fi done # fix changelog for openSUSE buildservice %changelog * Tue May 21 2024 15:20:01 +0000 Manvendra Bhangui 1.0.0-1.1%{?dist} Release 1.0.0-1.1 Start 06/06/2020 End 07/01/2024 - New package indimail-spamfilter - upgraded bogofilter version to 1.2.5 - Add AC_PROG_CC_C99 to configure - added debuginfo packages - enabled suse permissions - added scientic linux distribution - set/unset QMAILQUEUE=/usr/sbin/qmail-spamfilter on package installation/removal - PKGBUILD.in: Added missing variable definitions - changed permissions for dirs with 555 to 755 - format.c: fix format for '%' - indimail-spamfilter.spec: updated for copr builds - indimail-spamfilter.spec: fixed centos, rhel version - src/Makefile.am, src/version.sh: replaced egrep with grep -E - bogofilter.cf.example: updated run_type field - configure.ac, fixed --with-charset option - indimail-spamfilter.spec: Added glibc-locale-base to Requires - default.configure: added --with-charset=utf-8