2a8b17c
%if %{?fedora}%{!?fedora:0} >= 25 || %{?rhel}%{!?rhel:0} >= 8
2a8b17c
%global use_systemd 1
2a8b17c
%else
2a8b17c
%global use_systemd 0
2a8b17c
%endif
2a8b17c
ff25a5d
Name:		bdii
ff25a5d
Version:	5.2.23
2a8b17c
Release:	5%{?dist}
ff25a5d
Summary:	The Berkeley Database Information Index (BDII)
ff25a5d
ff25a5d
Group:		System Environment/Daemons
ff25a5d
License:	ASL 2.0
ff25a5d
URL:		http://gridinfo.web.cern.ch/
ff25a5d
#		The source for this package was pulled from upstream's vcs.
ff25a5d
#		Use the following commands to generate the tarball:
ff25a5d
#		svn export http://svn.cern.ch/guest/gridinfo/bdii/tags/R_5_2_23 %{name}-%{version}
ff25a5d
#		tar -z -c -f %{name}-%{version}.tar.gz %{name}-%{version}
ff25a5d
Source:		%{name}-%{version}.tar.gz
2a8b17c
Source1:	%{name}.service
2a8b17c
Source2:	%{name}-slapd.service
2a8b17c
Source3:	%{name}-slapd-start
ff25a5d
BuildArch:	noarch
ff25a5d
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
2a8b17c
%if %{use_systemd}
2a8b17c
BuildRequires:	systemd-units
2a8b17c
%endif
ff25a5d
ff25a5d
Requires:	openldap-clients
ff25a5d
Requires:	openldap-servers
ff25a5d
%if "%{?rhel}" == "5"
ff25a5d
#		The rwm overlay is in a separate package in RHEL 5
ff25a5d
Requires:	openldap-servers-overlays
ff25a5d
%endif
ff25a5d
Requires:	glue-schema >= 2.0.10
ff25a5d
ff25a5d
Requires(post):		expect
2a8b17c
%if %{use_systemd}
2a8b17c
Requires(post):		systemd-units
2a8b17c
Requires(preun):	systemd-units
2a8b17c
Requires(postun):	systemd-units
2a8b17c
%else
2a8b17c
Requires(post):		chkconfig
ff25a5d
Requires(preun):	chkconfig
ff25a5d
Requires(preun):	initscripts
ff25a5d
Requires(postun):	initscripts
2a8b17c
%endif
ff25a5d
ff25a5d
%if %{?fedora}%{!?fedora:0} >= 23 || %{?rhel}%{!?rhel:0} >= 8
ff25a5d
Requires(post):		policycoreutils-python-utils
ff25a5d
Requires(postun):	policycoreutils-python-utils
ff25a5d
%else
ff25a5d
%if %{?fedora}%{!?fedora:0} >= 11 || %{?rhel}%{!?rhel:0} >= 6
ff25a5d
Requires(post):		policycoreutils-python
ff25a5d
Requires(postun):	policycoreutils-python
ff25a5d
%else
ff25a5d
%if %{?fedora}%{!?fedora:0} >= 5 || %{?rhel}%{!?rhel:0} >= 5
ff25a5d
Requires(post):		policycoreutils
ff25a5d
Requires(postun):	policycoreutils
ff25a5d
%endif
ff25a5d
%endif
ff25a5d
%endif
ff25a5d
ff25a5d
%description
ff25a5d
The Berkeley Database Information Index (BDII) consists of a standard
ff25a5d
LDAP database which is updated by an external process. The update process
ff25a5d
obtains LDIF from a number of sources and merges them. It then compares
ff25a5d
this to the contents of the database and creates an LDIF file of the
ff25a5d
differences. This is then used to update the database.
ff25a5d
ff25a5d
%prep
ff25a5d
%setup -q
ff25a5d
ff25a5d
%build
ff25a5d
ff25a5d
%install
ff25a5d
rm -rf %{buildroot}
ff25a5d
make install prefix=%{buildroot}
ff25a5d
ff25a5d
chmod 644 %{buildroot}%{_sysconfdir}/sysconfig/%{name}
ff25a5d
ff25a5d
%if "%{?rhel}" == "5"
ff25a5d
# slapd in RHEL 5 had the relay backend compiled in and doesn't need to load it
ff25a5d
# slapd in RHEL 5 doesn't look in /usr/lib(64)?/openldap for modules by default
ff25a5d
sed -e '/moduleload back_relay/d' \
ff25a5d
    -e '/moduleload rwm/imodulepath /usr/lib/openldap' \
ff25a5d
    -e '/moduleload rwm/imodulepath /usr/lib64/openldap' \
ff25a5d
    -i %{buildroot}%{_sysconfdir}/%{name}/*-slapd.conf
ff25a5d
%endif
ff25a5d
2a8b17c
%if %{use_systemd}
2a8b17c
rm %{buildroot}%{_initrddir}/%{name}
2a8b17c
mkdir -p %{buildroot}%{_unitdir}
2a8b17c
install -m 644 -p %SOURCE1 %SOURCE2 %{buildroot}%{_unitdir}
2a8b17c
mkdir -p %{buildroot}%{_datadir}/%{name}
2a8b17c
install -p %SOURCE3 %{buildroot}%{_datadir}/%{name}
2a8b17c
%endif
2a8b17c
ff25a5d
%clean
ff25a5d
rm -rf %{buildroot}
ff25a5d
2a8b17c
%if %{use_systemd}
ff25a5d
%pre
2a8b17c
# Remove old init config when systemd is used
2a8b17c
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
2a8b17c
%endif
ff25a5d
ff25a5d
%post
ff25a5d
sed "s/\(rootpw *\)secret/\1$(mkpasswd -s 0 | tr '/' 'x')/" \
ff25a5d
    -i %{_sysconfdir}/%{name}/bdii-slapd.conf \
ff25a5d
       %{_sysconfdir}/%{name}/bdii-top-slapd.conf
ff25a5d
2a8b17c
%if %{use_systemd}
2a8b17c
%systemd_post %{name}.service
2a8b17c
%else
ff25a5d
/sbin/chkconfig --add %{name}
2a8b17c
%endif
ff25a5d
ff25a5d
%if %{?fedora}%{!?fedora:0} >= 5 || %{?rhel}%{!?rhel:0} >= 5
ff25a5d
semanage port -a -t ldap_port_t -p tcp 2170 2>/dev/null || :
ff25a5d
semanage fcontext -a -t slapd_db_t "%{_localstatedir}/lib/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5d
semanage fcontext -a -t slapd_var_run_t "%{_localstatedir}/run/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5d
# Remove selinux labels for old bdii var dir
ff25a5d
semanage fcontext -d -t slapd_db_t "%{_localstatedir}/run/%{name}(/.*)?" 2>/dev/null || :
ff25a5d
%endif
ff25a5d
ff25a5d
%preun
2a8b17c
%if %{use_systemd}
2a8b17c
%systemd_preun %{name}.service
2a8b17c
%else
ff25a5d
if [ $1 -eq 0 ]; then
ff25a5d
  service %{name} stop > /dev/null 2>&1
ff25a5d
  /sbin/chkconfig --del %{name}
ff25a5d
fi
2a8b17c
%endif
ff25a5d
ff25a5d
%postun
2a8b17c
%if %{use_systemd}
2a8b17c
%systemd_postun_with_restart %{name}.service
2a8b17c
%else
ff25a5d
if [ $1 -ge 1 ]; then
ff25a5d
  service %{name} condrestart > /dev/null 2>&1
ff25a5d
fi
2a8b17c
%endif
2a8b17c
ff25a5d
%if %{?fedora}%{!?fedora:0} >= 5 || %{?rhel}%{!?rhel:0} >= 5
ff25a5d
if [ $1 -eq 0 ]; then
ff25a5d
  semanage port -d -t ldap_port_t -p tcp 2170 2>/dev/null || :
ff25a5d
  semanage fcontext -d -t slapd_db_t "%{_localstatedir}/lib/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5d
  semanage fcontext -d -t slapd_var_run_t "%{_localstatedir}/run/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5d
fi
ff25a5d
%endif
ff25a5d
ff25a5d
%files
ff25a5d
%attr(-,ldap,ldap) %{_localstatedir}/lib/%{name}
ff25a5d
%attr(-,ldap,ldap) %{_localstatedir}/log/%{name}
ff25a5d
%dir %{_sysconfdir}/%{name}
ff25a5d
%config(noreplace) %{_sysconfdir}/%{name}/DB_CONFIG
ff25a5d
%config(noreplace) %{_sysconfdir}/%{name}/DB_CONFIG_top
ff25a5d
%config(noreplace) %{_sysconfdir}/%{name}/bdii.conf
ff25a5d
%config(noreplace) %{_sysconfdir}/%{name}/BDII.schema
ff25a5d
%attr(-,ldap,ldap) %config %{_sysconfdir}/%{name}/bdii-slapd.conf
ff25a5d
%attr(-,ldap,ldap) %config %{_sysconfdir}/%{name}/bdii-top-slapd.conf
ff25a5d
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
ff25a5d
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
2a8b17c
%if %{use_systemd}
2a8b17c
%{_unitdir}/bdii.service
2a8b17c
%{_unitdir}/bdii-slapd.service
2a8b17c
%dir %{_datadir}/%{name}
2a8b17c
%{_datadir}/%{name}/bdii-slapd-start
2a8b17c
%else
ff25a5d
%{_initrddir}/%{name}
2a8b17c
%endif
ff25a5d
%{_sbindir}/bdii-update
ff25a5d
%{_mandir}/man1/bdii-update.1*
ff25a5d
%doc copyright
ff25a5d
ff25a5d
%changelog
2a8b17c
* Mon Aug 15 2016 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.23-5
2a8b17c
- Convert to systemd unit files (Fedora 25+)
2a8b17c
ff25a5d
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-4
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
ff25a5d
ff25a5d
* Sun Jul 26 2015 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.23-3
ff25a5d
- Adapt to new policycoreutils packaging (Fedora 23+)
ff25a5d
ff25a5d
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.23-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
ff25a5d
ff25a5d
* Mon Oct 13 2014 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.23-1
ff25a5d
- New upstream version 5.2.23
ff25a5d
ff25a5d
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.22-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
ff25a5d
ff25a5d
* Mon Sep 09 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.22-1
ff25a5d
- New upstream version 5.2.22
ff25a5d
- Do not hardcode run directory
ff25a5d
ff25a5d
* Tue Aug 13 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.21-1
ff25a5d
- New upstream version 5.2.21
ff25a5d
ff25a5d
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.20-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
ff25a5d
ff25a5d
* Wed Jun 26 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.20-1
ff25a5d
- New upstream version 5.2.20
ff25a5d
ff25a5d
* Thu Mar 14 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.17-2
ff25a5d
- Don't use _libdir macro for noarch package
ff25a5d
ff25a5d
* Thu Mar 14 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.17-1
ff25a5d
- New upstream version 5.2.17
ff25a5d
ff25a5d
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.13-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
ff25a5d
ff25a5d
* Wed Aug 15 2012 Laurence Field <Laurence.Field@cern.ch> - 5.2.13-1
ff25a5d
- Included Fedora patches upstream.
ff25a5d
ff25a5d
* Fri Jul 20 2012 Maria Alandes <maria.alandes.pradillo@cern.ch> - 5.2.12-1
ff25a5d
- Fixed BDII_IPV6_SUPPORT after testing
ff25a5d
ff25a5d
* Wed Jul 18 2012 Maria Alandes <maria.alandes.pradillo@cern.ch> - 5.2.11-1
ff25a5d
- BUG 95122: Created SLAPD_DB_DIR directoy with correct ownership if it doesn't exist
ff25a5d
- BUG 95839: Added BDII_IPV6_SUPPORT
ff25a5d
ff25a5d
* Thu Mar 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.10-1
ff25a5d
- New upstream version that includes a new DB_CONFIG
ff25a5d
ff25a5d
* Wed Feb 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.9-1
ff25a5d
- Fixed /var/run packaging issue
ff25a5d
ff25a5d
* Wed Feb 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.8-1
ff25a5d
- Fixed a base64 encoding issue and added /var/run/bdii to the package
ff25a5d
ff25a5d
* Tue Feb 07 2012 Laurence Field <laurence.field@cern.ch> - 5.2.7-1
ff25a5d
- Performance improvements to reduce memory and disk usage
ff25a5d
ff25a5d
* Wed Jan 25 2012 Laurence Field <laurence.field@cern.ch> - 5.2.6-1
ff25a5d
- New upstream version that includes fedora patches and fix for EGI RT 3235
ff25a5d
ff25a5d
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.5-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
ff25a5d
ff25a5d
* Sun Sep 04 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.5-1
ff25a5d
- New upstream version 5.2.5
ff25a5d
ff25a5d
* Tue Jul 26 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.4-1
ff25a5d
- New upstream version 5.2.4
ff25a5d
- Drop patch accepted upstream: bdii-mdsvo.patch
ff25a5d
- Move large files away from /var/run in order not to fill up /run partition
ff25a5d
ff25a5d
* Mon Jun 27 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.3-2
ff25a5d
- Revert upstream hack that breaks ARC infosys
ff25a5d
ff25a5d
* Mon Jun 13 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.3-1
ff25a5d
- New upstream version 5.2.3
ff25a5d
- Drop patches accepted upstream: bdii-runuser.patch, bdii-context.patch,
ff25a5d
  bdii-default.patch, bdii-shadowerr.patch, bdii-sysconfig.patch
ff25a5d
ff25a5d
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.13-2
ff25a5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
ff25a5d
ff25a5d
* Sat Jan 01 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.13-1
ff25a5d
- New upstream version 5.1.13
ff25a5d
- Move restorecon from post sctiptlet to startup script in order to support
ff25a5d
  /var/run on tmpfs
ff25a5d
ff25a5d
* Thu Sep 23 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.9-1
ff25a5d
- New upstream version 5.1.9
ff25a5d
ff25a5d
* Thu Sep 02 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.8-1
ff25a5d
- New upstream version 5.1.8
ff25a5d
ff25a5d
* Fri Jun 18 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.7-1
ff25a5d
- New upstream version 5.1.7
ff25a5d
ff25a5d
* Sun May 23 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.5-1
ff25a5d
- New upstream release 5.1.5
ff25a5d
- Get rid of lsb initscript dependency
ff25a5d
ff25a5d
* Mon Apr 05 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.0-1
ff25a5d
- New upstream verison 5.1.0
ff25a5d
- Add SELinux context management to scriptlets
ff25a5d
ff25a5d
* Thu Mar 25 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-4.460
ff25a5d
- Update (svn revision 460)
ff25a5d
- Use proper anonymous svn checkout instead of svnweb generated tarball
ff25a5d
ff25a5d
* Fri Feb 26 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-3.443
ff25a5d
- Update (svn revision 443)
ff25a5d
ff25a5d
* Wed Feb 24 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-2.436
ff25a5d
- Update (svn revision 436)
ff25a5d
ff25a5d
* Mon Feb 08 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-1.375
ff25a5d
- Initial package (svn revision 375)