File gnarwl.spec of Package gnarwl

#
# spec file for package gnarwl
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           gnarwl
%define grp     %{name}
%define usr     %{name}

Summary:        Gnu Neat Auto Reply With LDAP
Version:        3.6
Release:        0
License:        GPL-2.0+
Group:          Productivity/Networking/Email/Utilities
URL:            http://www.onyxbits.de/gnarwl
Source0:        %{name}-%{version}.tar.gz
Patch0:         %{name}-DESTDIR.patch
Patch1:         %{name}-opt.patch
Patch2:         %{name}-fix-gcc46.patch
Patch3:         %{name}-damnit.patch
Patch4:         %{name}-doc.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  gdbm-devel
BuildRequires:  groff
%if 0%{?suse_version}
BuildRequires:  openldap2-devel
%define         schemadir /etc/openldap/schema
%else
BuildRequires:  openldap-devel
%define         schemadir /usr/share/openldap/schema
%endif

%description
Gnarwl is an email autoresponder. Unlike the original vacation(1) program, gnarwl is based on LDAP. Traditionally you had to give every user, who wanted to use autoreply facilities full fledged system accounts (trusting them to set their forwarding up properly, cursing when they didn't). With gnarwl this is history. User information is now stored in LDAP. Thats right, no more messing around with system accounts or homedirs for users who just want their email working, but don't care to fuss around with shell commands.

%package openldap-schema-ISPEnv2
Summary:        LDAP schema for gnarwl
Group:          Productivity/Networking/LDAP/Utilities
%if 0%{?suse_version}
Requires:	openldap2
%else
Requires:	openldap-servers
%endif

%description openldap-schema-ISPEnv2
This package contains ISPEnv2.schema to be used with gnarwl.

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

%build
%if 0%{?suse_version}
%configure \
  --with-homedir=/var/lib/%{name}
%else
./configure \
  --prefix=%{_prefix} \
  --bindir=%{_bindir} \
  --sbindir=%{_sbindir} \
  --sysconfdir=%{_sysconfdir} \
  --datadir=%{_datadir} \
  --mandir=%{_mandir} \
  --with-homedir=/var/lib/%{name}
%endif
%{__make}

%install
%if 0%{?suse_version}
%makeinstall
%else
%{__rm} -rf %{buildroot}
%{__make} DESTDIR=%{buildroot} install
%endif

%{__install} -D -m 0644 doc/ISPEnv2.schema %{buildroot}%{schemadir}/ISPEnv2.schema

%pre
# add gnarwl group
%{_sbindir}/groupadd -r %{grp} 2>/dev/null || :
# add gnarwl user
%{_sbindir}/useradd -c "Gnarwl User" -d /var/lib/%{name} \
  -G %{grp} -g %{grp} -r -s /bin/bash %{name} 2>/dev/null || :

%post openldap-schema-ISPEnv2
#%openldap_schema_register %{schemadir}/ISPEnv2.schema -d core,cosine
#%service -q ldap restart

%postun openldap-schema-ISPEnv2
#if [ "$1" = "0" ]; then
#	%openldap_schema_unregister %{schemadir}/ISPEnv2.schema
#	%service -q ldap restart
#fi

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc doc/{AUTHORS,FAQ,HISTORY,INSTALL,ISPEnv.schema,LICENSE,README,README.upgrade,example.ldif}
%{_bindir}/%{name}
%{_sbindir}/damnit
%config(noreplace) %verify(not md5 mtime size) %attr(640,root,%{grp}) %{_sysconfdir}/%{name}.cfg
%attr(755,root,%{grp}) %dir %{_var}/lib/%{name}
%attr(775,root,%{grp}) %dir %{_var}/lib/%{name}/block
%attr(755,root,%{grp}) %dir %{_var}/lib/%{name}/bin
%attr(640,root,%{grp}) %{_var}/lib/%{name}/.forward
%attr(660,root,%{grp}) %{_var}/lib/%{name}/blacklist.db
%attr(660,root,%{grp}) %{_var}/lib/%{name}/badheaders.db
%attr(640,root,%{grp}) %{_var}/lib/%{name}/footer.txt
%attr(640,root,%{grp}) %{_var}/lib/%{name}/header.txt
%doc %{_mandir}/man?/*

%files openldap-schema-ISPEnv2
%defattr(-,root,root)
%if 0%{?suse_version}
%dir %{_sysconfdir}/openldap
%endif
%dir %{schemadir}
%config %{schemadir}/*.schema

%changelog

openSUSE Build Service is sponsored by