File smbldap-tools.spec of Package smbldap-tools

# $Source: $
%define version 0.9.10
%define release 1.0
%define name	smbldap-tools
%define _prefix	/usr

Summary:	User & Group administration tools for Samba/LDAP
Name: 		%{name}
version: 	%{version}
Release: 	%{release}
Group: 		System Environment/Base
License: 	GPL
URL:		https://gna.org/projects/smbldap-tools/
Packager:	Stefan Schaefer <stefan@invis-server.org>
Source0: 	%{name}-%{version}.tar.bz2
BuildRoot: 	/%{_tmppath}/%{name}
BuildRequires:	perl >= 5.6
BuildRequires:  openssl
Requires:	perl >= 5.6
Requires:   perl-Digest-SHA1
Requires:   perl-IO-Socket-SSL
Requires:   perl-Jcode
Requires:   perl-Net-LDAP
Requires:   perl-Unicode-Map
Requires:   perl-Unicode-Map8
Requires:   perl-Unicode-MapUTF8
Requires:   perl-Unicode-String
Prefix:		%{_prefix}
BuildArch:	noarch

Patch1:		norootpw.patch
Patch2:     podlators.diff

%description
Smbldap-tools is a set of perl scripts designed to manage user and group 
accounts stored in an LDAP directory. They can be used both by users and 
administrators of Linux systems: 

* administrators can perform users and groups management operations, in a 
  way similar to the standard useradd or groupmod commands
* users can change their LDAP password from the command line and get/change
  personnal informations

%package doc
Summary:        Documentation package to smbldap-tools
Group:          Productivity/Networking/Samba
Requires:       smbldap-tools = %{version}

%description doc
Smbldap-tools is a set of perl scripts designed to manage user and group
accounts stored in an LDAP directory. They can be used both by users and
administrators of Linux systems.

%prep
%setup -q

%patch -P 1
%patch -P 2 -p1

rm %{name}.spec

%build
# Figure out where ssl stuff goes
%if 0%{?suse_version}
%define cadir /etc/ssl
%define cafile ca-bundle.pem
%else
%define cadir /etc/pki/tls/certs
%define cafile ca-bundle.crt
%endif
%define use_pki %(if [ -f %{cadir}/%{cafile} ]; then echo 1; else echo 0; fi)
%if ! %{use_pki}
%{__perl} -pi -e 's|%{cadir}|%{_datadir}/ssl/certs/|g;' smbldap.conf
%endif
%configure
make

%install
make install DESTDIR=%{buildroot}
install -d -m 755 %{buildroot}%{_mandir}/man8/
install -p -m 644 smbldap-*.8 %{buildroot}%{_mandir}/man8/
install -d -m 755 %{buildroot}%{_sysconfdir}/smbldap-tools/
install -p -m 644 smbldap.conf %{buildroot}%{_sysconfdir}/smbldap-tools/smbldap.conf
install -p -m 600 smbldap_bind.conf %{buildroot}%{_sysconfdir}/smbldap-tools/smbldap_bind.conf

# Install migration script for pre-0.9.7 users
sed -e 's|@PERL_COMMAND@|/usr/bin/perl|' smbldap-upgrade-0.9.6.pl > \
	%{buildroot}%{_sbindir}/smbldap-upgrade-0.9.6.pl
chmod 755 %{buildroot}%{_sbindir}/smbldap-upgrade-0.9.6.pl


%clean
if [ -n "$RPM_BUILD_ROOT" ] ; then
   [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
fi

%post
if [ -f /usr/lib/perl5/site_perl/smbldap_tools.pm ] ; then
	rm -f /usr/lib/perl5/site_perl/smbldap_tools.pm
fi
if [ -f /usr/lib/perl5/site_perl/smbldap_conf.pm ] ; then
	rm -f /usr/lib/perl5/site_perl/smbldap_conf.pm
fi

if [ ! -n `grep with_slappasswd %{_sysconfdir}/smbldap-tools/smbldap.conf | grep -v "^#"` ] ; then
        echo "Check if you have the with_slappasswd parameter defined"
	echo "in smbldap.conf file (see the INSTALL file)"
fi

%files
%defattr(-,root,root)
%{_sbindir}/smbldap*
%doc CONTRIBUTORS COPYING ChangeLog FILES INFRA README INSTALL TODO
%doc %{_mandir}/man8/*
%defattr(644,root,root)
%{perl_vendorlib}/smbldap*
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/smbldap.conf
%defattr(600,root,root)
%config(noreplace) %{_sysconfdir}/%{name}/smbldap_bind.conf

%files doc
%defattr(644,root,root,0755)
%doc doc/*.html
%doc doc/*.pdf


%changelog
* Sun Nov 3 2013 Ingo Goeppert <ingo.goeppert@gmx.de>
- Fix build with podlators >= 2.5.0
* Sat Jul 27 2013 Stefan Schaefer <stefan@invis-server.org>
- New Version 0.9.10
* Fri Apr 08 2011 Stefan Schaefer <stefan@invis-server.org>
- New Version 0.9.6
* Sat Mar 06 2010 Stefan Schaefer <stefan@invis-server.org>
- Password-Request for root in smbldap-populate removed
* Sun Jan 18 2009 Stefan Schaefer <stefan@invis-server.org>
- some fixes in specfile to work at opensuse buildservice
* Fri Aug 10 2007 Jerome Tournier <jtournier@gmail.com> 0.9.4-1
- see Changelog file for updates in scripts

openSUSE Build Service is sponsored by