2a8b17
%if %{?fedora}%{!?fedora:0} >= 25 || %{?rhel}%{!?rhel:0} >= 8
2a8b17
%global use_systemd 1
2a8b17
%else
2a8b17
%global use_systemd 0
2a8b17
%endif
2a8b17
ff25a5
Name:		bdii
bbaf74
Version:	5.2.25
735a2c
Release:	7%{?dist}
ff25a5
Summary:	The Berkeley Database Information Index (BDII)
ff25a5
ff25a5
License:	ASL 2.0
bbaf74
URL:		https://github.com/EGI-Foundation/bdii
bbaf74
Source:		https://github.com/EGI-Foundation/bdii/archive/v%{version}/%{name}-%{version}.tar.gz
2a8b17
Source1:	%{name}.service
2a8b17
Source2:	%{name}-slapd.service
2a8b17
Source3:	%{name}-slapd-start
837ac2
#		Python 3 support (from upstream pull request)
837ac2
#		https://github.com/EGI-Foundation/bdii/pull/15
837ac2
Patch0:		%{name}-py3.patch
ff25a5
BuildArch:	noarch
2a8b17
%if %{use_systemd}
76b45e
BuildRequires:	systemd
2a8b17
%endif
ff25a5
ff25a5
Requires:	openldap-clients
ff25a5
Requires:	openldap-servers
ff25a5
Requires:	glue-schema >= 2.0.10
ff25a5
42145c
Requires(post):		/usr/bin/mkpasswd
2a8b17
%if %{use_systemd}
76b45e
%{?systemd_requires}
2a8b17
%else
2a8b17
Requires(post):		chkconfig
ff25a5
Requires(preun):	chkconfig
ff25a5
Requires(preun):	initscripts
ff25a5
Requires(postun):	initscripts
2a8b17
%endif
ff25a5
ff25a5
%if %{?fedora}%{!?fedora:0} >= 23 || %{?rhel}%{!?rhel:0} >= 8
ff25a5
Requires(post):		policycoreutils-python-utils
ff25a5
Requires(postun):	policycoreutils-python-utils
ff25a5
%else
76b45e
Requires(post):		policycoreutils-python
76b45e
Requires(postun):	policycoreutils-python
ff25a5
%endif
ff25a5
ff25a5
%description
ff25a5
The Berkeley Database Information Index (BDII) consists of a standard
ff25a5
LDAP database which is updated by an external process. The update process
ff25a5
obtains LDIF from a number of sources and merges them. It then compares
ff25a5
this to the contents of the database and creates an LDIF file of the
ff25a5
differences. This is then used to update the database.
ff25a5
ff25a5
%prep
ff25a5
%setup -q
837ac2
%patch0 -p1
ff25a5
ff25a5
%build
ff25a5
ff25a5
%install
ff25a5
make install prefix=%{buildroot}
ff25a5
837ac2
# Don't use /usr/bin/env shebang
837ac2
%if %{?fedora}%{!?fedora:0} >= 31 || %{?rhel}%{!?rhel:0} >= 8
837ac2
sed 's!%{_bindir}/env .*!%{__python3}!' -i %{buildroot}%{_sbindir}/bdii-update
837ac2
%else
837ac2
sed 's!%{_bindir}/env .*!%{__python2}!' -i %{buildroot}%{_sbindir}/bdii-update
837ac2
%endif
ff25a5
bbaf74
rm -rf %{buildroot}%{_docdir}/%{name}
bbaf74
2a8b17
%if %{use_systemd}
2a8b17
rm %{buildroot}%{_initrddir}/%{name}
2a8b17
mkdir -p %{buildroot}%{_unitdir}
2a8b17
install -m 644 -p %SOURCE1 %SOURCE2 %{buildroot}%{_unitdir}
2a8b17
mkdir -p %{buildroot}%{_datadir}/%{name}
2a8b17
install -p %SOURCE3 %{buildroot}%{_datadir}/%{name}
2a8b17
%endif
2a8b17
2a8b17
%if %{use_systemd}
ff25a5
%pre
2a8b17
# Remove old init config when systemd is used
2a8b17
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
2a8b17
%endif
ff25a5
ff25a5
%post
ff25a5
sed "s/\(rootpw *\)secret/\1$(mkpasswd -s 0 | tr '/' 'x')/" \
ff25a5
    -i %{_sysconfdir}/%{name}/bdii-slapd.conf \
ff25a5
       %{_sysconfdir}/%{name}/bdii-top-slapd.conf
ff25a5
2a8b17
%if %{use_systemd}
2a8b17
%systemd_post %{name}.service
2a8b17
%else
ff25a5
/sbin/chkconfig --add %{name}
2a8b17
%endif
ff25a5
ff25a5
semanage port -a -t ldap_port_t -p tcp 2170 2>/dev/null || :
ff25a5
semanage fcontext -a -t slapd_db_t "%{_localstatedir}/lib/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5
semanage fcontext -a -t slapd_var_run_t "%{_localstatedir}/run/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5
# Remove selinux labels for old bdii var dir
ff25a5
semanage fcontext -d -t slapd_db_t "%{_localstatedir}/run/%{name}(/.*)?" 2>/dev/null || :
ff25a5
ff25a5
%preun
2a8b17
%if %{use_systemd}
2a8b17
%systemd_preun %{name}.service
2a8b17
%else
ff25a5
if [ $1 -eq 0 ]; then
ff25a5
  service %{name} stop > /dev/null 2>&1
ff25a5
  /sbin/chkconfig --del %{name}
ff25a5
fi
2a8b17
%endif
ff25a5
ff25a5
%postun
2a8b17
%if %{use_systemd}
2a8b17
%systemd_postun_with_restart %{name}.service
2a8b17
%else
ff25a5
if [ $1 -ge 1 ]; then
ff25a5
  service %{name} condrestart > /dev/null 2>&1
ff25a5
fi
2a8b17
%endif
2a8b17
ff25a5
if [ $1 -eq 0 ]; then
ff25a5
  semanage port -d -t ldap_port_t -p tcp 2170 2>/dev/null || :
ff25a5
  semanage fcontext -d -t slapd_db_t "%{_localstatedir}/lib/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5
  semanage fcontext -d -t slapd_var_run_t "%{_localstatedir}/run/%{name}/db(/.*)?" 2>/dev/null || :
ff25a5
fi
ff25a5
ff25a5
%files
ff25a5
%attr(-,ldap,ldap) %{_localstatedir}/lib/%{name}
ff25a5
%attr(-,ldap,ldap) %{_localstatedir}/log/%{name}
ff25a5
%dir %{_sysconfdir}/%{name}
ff25a5
%config(noreplace) %{_sysconfdir}/%{name}/DB_CONFIG
ff25a5
%config(noreplace) %{_sysconfdir}/%{name}/DB_CONFIG_top
ff25a5
%config(noreplace) %{_sysconfdir}/%{name}/bdii.conf
ff25a5
%config(noreplace) %{_sysconfdir}/%{name}/BDII.schema
ff25a5
%attr(-,ldap,ldap) %config %{_sysconfdir}/%{name}/bdii-slapd.conf
ff25a5
%attr(-,ldap,ldap) %config %{_sysconfdir}/%{name}/bdii-top-slapd.conf
ff25a5
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
ff25a5
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
2a8b17
%if %{use_systemd}
2a8b17
%{_unitdir}/bdii.service
2a8b17
%{_unitdir}/bdii-slapd.service
2a8b17
%dir %{_datadir}/%{name}
2a8b17
%{_datadir}/%{name}/bdii-slapd-start
2a8b17
%else
ff25a5
%{_initrddir}/%{name}
2a8b17
%endif
ff25a5
%{_sbindir}/bdii-update
ff25a5
%{_mandir}/man1/bdii-update.1*
bbaf74
%doc AUTHORS README.md
bbaf74
%license COPYRIGHT LICENSE.txt
ff25a5
ff25a5
%changelog
735a2c
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.25-7
735a2c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
735a2c
7b1125
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.25-6
7b1125
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
7b1125
837ac2
* Thu Sep 19 2019 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.25-5
837ac2
- Python 3 support (from upstream pull request)
837ac2
- Use Python 3 for Fedora 31+ and EPEL 8+
837ac2
e3ef51
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.25-4
e3ef51
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
e3ef51
42145c
* Mon Jun 03 2019 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.25-3
42145c
- Use /usr/bin/mkpasswd instead of expect as Requires
42145c
  (mkpasswd is no longer provided by the expect rpm in Fedora 30+)
42145c
3e481e
* Tue Apr 09 2019 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.25-2
3e481e
- Define __python2 if undefined
3e481e
bbaf74
* Tue Apr 09 2019 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.25-1
bbaf74
- Version 5.2.25
bbaf74
- Upstream project moved to github
bbaf74
da7d1a
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-12
da7d1a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
da7d1a
76b45e
* Tue Nov 13 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.23-11
76b45e
- Don't use /usr/bin/python shebang
76b45e
- Remove EPEL 5 conditionals
76b45e
480774
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-10
480774
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
480774
87eb61
* Wed Feb 07 2018 Iryna Shcherbina <ishcherb@redhat.com> - 5.2.23-9
87eb61
- Update Python 2 dependency declarations to new packaging standards
87eb61
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
87eb61
51c4c3
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-8
51c4c3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
51c4c3
ed1498
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-7
ed1498
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
ed1498
b090d2
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-6
b090d2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
b090d2
2a8b17
* Mon Aug 15 2016 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.2.23-5
2a8b17
- Convert to systemd unit files (Fedora 25+)
2a8b17
ff25a5
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.23-4
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
ff25a5
ff25a5
* Sun Jul 26 2015 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.23-3
ff25a5
- Adapt to new policycoreutils packaging (Fedora 23+)
ff25a5
ff25a5
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.23-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
ff25a5
ff25a5
* Mon Oct 13 2014 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.23-1
ff25a5
- New upstream version 5.2.23
ff25a5
ff25a5
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.22-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
ff25a5
ff25a5
* Mon Sep 09 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.22-1
ff25a5
- New upstream version 5.2.22
ff25a5
- Do not hardcode run directory
ff25a5
ff25a5
* Tue Aug 13 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.21-1
ff25a5
- New upstream version 5.2.21
ff25a5
ff25a5
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.20-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
ff25a5
ff25a5
* Wed Jun 26 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.20-1
ff25a5
- New upstream version 5.2.20
ff25a5
ff25a5
* Thu Mar 14 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.17-2
ff25a5
- Don't use _libdir macro for noarch package
ff25a5
ff25a5
* Thu Mar 14 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.17-1
ff25a5
- New upstream version 5.2.17
ff25a5
ff25a5
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.13-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
ff25a5
ff25a5
* Wed Aug 15 2012 Laurence Field <Laurence.Field@cern.ch> - 5.2.13-1
ff25a5
- Included Fedora patches upstream.
ff25a5
ff25a5
* Fri Jul 20 2012 Maria Alandes <maria.alandes.pradillo@cern.ch> - 5.2.12-1
ff25a5
- Fixed BDII_IPV6_SUPPORT after testing
ff25a5
ff25a5
* Wed Jul 18 2012 Maria Alandes <maria.alandes.pradillo@cern.ch> - 5.2.11-1
ff25a5
- BUG 95122: Created SLAPD_DB_DIR directoy with correct ownership if it doesn't exist
ff25a5
- BUG 95839: Added BDII_IPV6_SUPPORT
ff25a5
ff25a5
* Thu Mar 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.10-1
ff25a5
- New upstream version that includes a new DB_CONFIG
ff25a5
ff25a5
* Wed Feb 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.9-1
ff25a5
- Fixed /var/run packaging issue
ff25a5
ff25a5
* Wed Feb 08 2012 Laurence Field <laurence.field@cern.ch> - 5.2.8-1
ff25a5
- Fixed a base64 encoding issue and added /var/run/bdii to the package
ff25a5
ff25a5
* Tue Feb 07 2012 Laurence Field <laurence.field@cern.ch> - 5.2.7-1
ff25a5
- Performance improvements to reduce memory and disk usage
ff25a5
ff25a5
* Wed Jan 25 2012 Laurence Field <laurence.field@cern.ch> - 5.2.6-1
ff25a5
- New upstream version that includes fedora patches and fix for EGI RT 3235
ff25a5
ff25a5
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.5-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
ff25a5
ff25a5
* Sun Sep 04 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.5-1
ff25a5
- New upstream version 5.2.5
ff25a5
ff25a5
* Tue Jul 26 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.4-1
ff25a5
- New upstream version 5.2.4
ff25a5
- Drop patch accepted upstream: bdii-mdsvo.patch
ff25a5
- Move large files away from /var/run in order not to fill up /run partition
ff25a5
ff25a5
* Mon Jun 27 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.3-2
ff25a5
- Revert upstream hack that breaks ARC infosys
ff25a5
ff25a5
* Mon Jun 13 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.2.3-1
ff25a5
- New upstream version 5.2.3
ff25a5
- Drop patches accepted upstream: bdii-runuser.patch, bdii-context.patch,
ff25a5
  bdii-default.patch, bdii-shadowerr.patch, bdii-sysconfig.patch
ff25a5
ff25a5
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.13-2
ff25a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
ff25a5
ff25a5
* Sat Jan 01 2011 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.13-1
ff25a5
- New upstream version 5.1.13
ff25a5
- Move restorecon from post sctiptlet to startup script in order to support
ff25a5
  /var/run on tmpfs
ff25a5
ff25a5
* Thu Sep 23 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.9-1
ff25a5
- New upstream version 5.1.9
ff25a5
ff25a5
* Thu Sep 02 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.8-1
ff25a5
- New upstream version 5.1.8
ff25a5
ff25a5
* Fri Jun 18 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.7-1
ff25a5
- New upstream version 5.1.7
ff25a5
ff25a5
* Sun May 23 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.5-1
ff25a5
- New upstream release 5.1.5
ff25a5
- Get rid of lsb initscript dependency
ff25a5
ff25a5
* Mon Apr 05 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.1.0-1
ff25a5
- New upstream verison 5.1.0
ff25a5
- Add SELinux context management to scriptlets
ff25a5
ff25a5
* Thu Mar 25 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-4.460
ff25a5
- Update (svn revision 460)
ff25a5
- Use proper anonymous svn checkout instead of svnweb generated tarball
ff25a5
ff25a5
* Fri Feb 26 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-3.443
ff25a5
- Update (svn revision 443)
ff25a5
ff25a5
* Wed Feb 24 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-2.436
ff25a5
- Update (svn revision 436)
ff25a5
ff25a5
* Mon Feb 08 2010 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.0.8-1.375
ff25a5
- Initial package (svn revision 375)