File aide.spec of Package aide

#
# spec file for package aide
#

%define selinux 0
%define maketest 0
%define curl 1
%define pgsql 1

Name:           aide
Version:        0.15.1
Release:        1
Summary:        Advanced Intrusion Detection Environment
License:        GPL-2.0+
Group:          Productivity/Security
Source0:        http://www.cs.tut.fi/~rammer/aide-%{version}.tar.bz2
Source1:        aide.conf
Source2:        aide-cron_daily.sh
Source3:        aide-test.sh
Source4:        aide-rpmlintrc
Patch1:         aide-%{version}-as-needed.patch
Patch2:         aide-no_m4_dir.patch
Patch3:         aide-xattr-in-libc.patch
Patch4:         aide_enoattr.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://sourceforge.net/projects/aide/

%if 0%{?suse_version} >= 1100
BuildRequires:  -post-build-checks
%endif

BuildRequires:  automake
BuildRequires:  bison
%if 0%{?curl}
BuildRequires:  curl-devel
#!BuildIgnore:  dba-curl-7371
%endif
BuildRequires:  flex
BuildRequires:  libacl-devel
BuildRequires:  libgcrypt-devel
%if 0%{?selinux}
BuildRequires:  libselinux-devel
%endif
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
BuildRequires:  openssl-devel

%if 0%{?centos_version} >= 400 && 0%{?centos_version} <= 599 || 0%{?rhel_version} >= 406 && 0%{?rhel_version} <= 599
%define pgsql   0
%endif

%if 0%{?sles_version} == 10
%define pgsql   0
%endif

%if 0%{?pgsql}
# BuildRequires:  dba-postgresql-8422
BuildRequires:  dba-postgresql-8422-static
%define pgdir /DBA/postgresql/8.4.22
#!BuildIgnore:	postgresql-devel
%endif


#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101e


%description
AIDE is an intrusion detection system that checks file integrity.

%package test
Summary:        Simple AIDE testing
Group:          Productivity/Security

%description test
Simple AIDE test script for externalized testing.


%prep
%setup -q
%patch1 -p1
%patch2
%patch3 -p1
%patch4 -p1


%build
autoreconf -fiv

%if 0%{?pgsql}
# LDFLAGS=-lpq
# export LDFLAGS
%endif

%configure 					\
	--with-config_file=/etc/aide.conf	\
	--with-dbhmactype=md5			\
	--disable-static			\
	--enable-lfs				\
	--with-posix-acl			\
	--with-xattr				\
%if 0%{?selinux}
	--with-selinux				\
%endif
%if 0%{?pgsql}
	--with-psql				\
	--with-extra-includes="-I%{?pgdir}/include" \
	--with-extra-libs="-L%{pgdir}/lib -lpq" \
%endif
%if 0%{?curl}
	--with-curl				\
%else
	--without-curl				\
%endif
	--with-zlib \
    --with-gcrypt \
    --without-mhash
# --enable-forced_configmd
make %{?_smp_mflags}


%install
make DESTDIR=$RPM_BUILD_ROOT install
install -m 700 -d     $RPM_BUILD_ROOT/var/lib/aide
install -m 700 -d     $RPM_BUILD_ROOT/etc
install -m 600 %{S:1} $RPM_BUILD_ROOT/etc/aide.conf
install -m 700 %{S:3} $RPM_BUILD_ROOT/usr/bin/
mkdir -p doc/examples/etc/cron.daily/
cp -a %{S:2} doc/examples/etc/cron.daily/aide.sh


%if 0%{?maketest}
%check
mkdir /var/tmp/aide-test
export TESTDIR=/var/tmp/aide-test
make DESTDIR=$TESTDIR install
install -m 700 -d $TESTDIR/var/lib/aide
install -m 700 -d $TESTDIR/etc
install -m 600    %{S:1} $TESTDIR/etc/aide.conf.new
sed -e "s#/var/lib/aide#$TESTDIR/var/lib/aide#g" <$TESTDIR/etc/aide.conf.new >$TESTDIR/etc/aide.conf
sleep 2
sync
sleep 2

$TESTDIR/usr/bin/aide -c $TESTDIR/etc/aide.conf --init
mv $TESTDIR/var/lib/aide/aide.db.new $TESTDIR/var/lib/aide/aide.db
$TESTDIR/usr/bin/aide -c $TESTDIR/etc/aide.conf --check --verbose

rm -rf $TESTDIR

%endif


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README doc/manual* aide.* doc/examples
%{_prefix}/bin/aide
/%{_mandir}/man1/aide.1.gz
/%{_mandir}/man5/aide.conf.5.gz
/var/lib/aide
%config(noreplace) /etc/aide.conf


%files test
%defattr(-,root,root)
/usr/bin/aide-test.sh


%changelog
* Tue Nov 25 2014 Holger Manthey <holger.manthey@bertelsmann.de>
- static postgresql build
* Mon Nov 24 2014 Holger Manthey <holger.manthey@bertelsmann.de>
- inital version
openSUSE Build Service is sponsored by