- bdb upgraded to 4.6.21
- reworked upgrade logic again to run db_upgrade when bdb version changes
This commit is contained in:
parent
68c2fe40b8
commit
bb50ce36bc
101
openldap.spec
101
openldap.spec
@ -1,4 +1,7 @@
|
||||
%define db_version 4.4.20
|
||||
# We distribute own version of Berkeley DB to prevent
|
||||
# problems on db4.rpm upgrade - some versions of db4 do
|
||||
# not work with some versions of OpenLDAP.
|
||||
%define db_version 4.6.21
|
||||
%define ldbm_backend berkeley
|
||||
%define version 2.4.8
|
||||
%define evolution_connector_prefix %{_libdir}/evolution-openldap
|
||||
@ -8,7 +11,7 @@
|
||||
Summary: The configuration files, libraries, and documentation for OpenLDAP
|
||||
Name: openldap
|
||||
Version: %{version}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: OpenLDAP
|
||||
Group: System Environment/Daemons
|
||||
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
|
||||
@ -37,8 +40,7 @@ Patch10: openldap-2.4.6-multilib.patch
|
||||
Patch200: openldap-2.4.6-evolution-ntlm.patch
|
||||
|
||||
# Patches for db4 library
|
||||
Patch400: db-4.4.20-1.patch
|
||||
Patch401: db-4.4.20-2.patch
|
||||
|
||||
|
||||
URL: http://www.openldap.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
@ -118,8 +120,6 @@ programs needed for accessing and modifying OpenLDAP directories.
|
||||
%setup -q -c -a 1
|
||||
|
||||
pushd db-%{db_version}
|
||||
%patch400 -b .patch1
|
||||
%patch401 -b .patch2
|
||||
popd
|
||||
|
||||
pushd openldap-%{version}
|
||||
@ -179,13 +179,10 @@ pushd db-%{db_version}/build-rpm
|
||||
--with-pic \
|
||||
--disable-static \
|
||||
--enable-shared \
|
||||
--with-uniquename=_openldap_slapd_rhl_42 \
|
||||
--with-uniquename=_openldap_slapd_46 \
|
||||
--prefix=${dbdir} \
|
||||
--includedir=${dbdir}/include \
|
||||
--libdir=${dbdir}/%{_lib}${subdir:+/${subdir}}
|
||||
# XXX db-4.2.x handles O_DIRECT (by disabling on linux) correctly.
|
||||
# XXX hack out O_DIRECT support in db4 for now.
|
||||
perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' db_config.h
|
||||
# fix libtool: no rpath
|
||||
perl -pi -e 's|hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"-L\\\$libdir\"|g;' libtool
|
||||
|
||||
@ -194,17 +191,15 @@ make install libdb_base=libslapd_db libso_base=libslapd_db strip="false"
|
||||
ln -sf libslapd_db.so ${dbdir}/%{_lib}/${subdir}/libdb.so
|
||||
popd
|
||||
|
||||
# Find OpenSSL's header and library dependencies.
|
||||
if pkg-config openssl ; then
|
||||
OPENSSL_CPPFLAGS=`pkg-config --cflags-only-I openssl`
|
||||
CPPFLAGS="$OPENSSL_CPPFLAGS" ; export CPPFLAGS
|
||||
OPENSSL_LDFLAGS=`pkg-config --libs-only-L openssl`
|
||||
LDFLAGS="$OPENSSL_LDFLAGS" ; export LDFLAGS
|
||||
fi
|
||||
CPPFLAGS="-I${dbdir}/include $OPENSSL_CPPFLAGS" ; export CPPFLAGS
|
||||
CFLAGS="$CPPFLAGS $RPM_OPT_FLAGS -D_REENTRANT -fPIC -D_GNU_SOURCE"; export CFLAGS
|
||||
LDFLAGS="-L${dbdir}/%{_lib} $OPENSSL_LDFLAGS" ; export LDFLAGS
|
||||
LD_LIBRARY_PATH=${dbdir}/%{_lib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}; export LD_LIBRARY_PATH
|
||||
export CPPFLAGS="-I${dbdir}/include"
|
||||
export CFLAGS="$CPPFLAGS $RPM_OPT_FLAGS -D_REENTRANT -fPIC -D_GNU_SOURCE"
|
||||
export LDFLAGS="-L${dbdir}/%{_lib}"
|
||||
export LD_LIBRARY_PATH=${dbdir}/%{_lib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
||||
|
||||
# hack to get properly named __lock_getlocker - needed for bdb 4.6.21 + openldap2.4.8
|
||||
# check later releases
|
||||
export CPPFLAGS="$CPPFLAGS -D __lock_getlocker=__lock_getlocker_openldap_slapd_46"
|
||||
export CFLAGS="$CFLAGS -D __lock_getlocker=__lock_getlocker_openldap_slapd_46"
|
||||
|
||||
build() {
|
||||
%configure \
|
||||
@ -417,13 +412,25 @@ if /usr/sbin/useradd -c "LDAP User" -u 55 \
|
||||
fi
|
||||
|
||||
if [ "$1" = "2" ]; then
|
||||
OLD_VERSION=$( rpm -q --qf "%{VERSION}" openldap-servers | sed 's/\.[0-9]*$//' )
|
||||
NEW_VERSION=$( echo %{version} | sed 's/\.[0-9]*$//' )
|
||||
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
|
||||
# guess, if database upgrade is necessary
|
||||
OLD_BDB_VERSION=$( slapd_db_upgrade -V | sed 's/.* \([0-9\.]*\)\.[0-9]*:.*/\1/' )
|
||||
NEW_BDB_VERSION=$( echo %{db_version} | sed 's/.[0-9]*$//' )
|
||||
|
||||
OLD_SLAPD_VERSION=$( rpm -q --qf "%{VERSION}" openldap-servers | sed 's/\.[0-9]*$//' )
|
||||
NEW_SLAPD_VERSION=$( echo %{version} | sed 's/\.[0-9]*$//' )
|
||||
|
||||
if [ "$OLD_SLAPD_VERSION" != "$NEW_SLAPD_VERSION" ]; then
|
||||
# Minor version number has changed -> slapcat/slapadd of the BDB database
|
||||
# is necessary. Save an ldif of the database where the "% post servers"
|
||||
# scriptlet can restore it. Also save the database files to a "rpmorig"
|
||||
# directory - Just In Case (TM)
|
||||
|
||||
# stop the server
|
||||
if /sbin/service ldap status &>/dev/null; then
|
||||
touch /var/lib/ldap/need_start
|
||||
/sbin/service ldap stop &>/dev/null
|
||||
fi
|
||||
|
||||
files=$(echo /var/lib/ldap/{log.*,__db.*,[a]lock})
|
||||
if [ "$files" != '/var/lib/ldap/log.* /var/lib/ldap/__db.* /var/lib/ldap/[a]lock' ] ; then
|
||||
if /usr/sbin/slapcat -l /var/lib/ldap/upgrade.ldif > /dev/null 2>&1 ; then
|
||||
@ -437,8 +444,24 @@ if [ "$1" = "2" ]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$OLD_BDB_VERSION" != "$NEW_BDB_VERSION" ]; then
|
||||
# Minor version number of bdb has changed -> run db_upgrade in % post script
|
||||
|
||||
# stop the server
|
||||
if /sbin/service ldap status &>/dev/null; then
|
||||
touch /var/lib/ldap/need_start
|
||||
/sbin/service ldap stop &>/dev/null
|
||||
fi
|
||||
|
||||
# Ensure, that the database is correct
|
||||
/sbin/runuser -m -s /usr/sbin/slapd_db_recover -- "ldap" -h /var/lib/ldap &>/dev/null
|
||||
# Just create /var/lib/ldap/need_db_upgrade so % post knows
|
||||
touch /var/lib/ldap/need_db_upgrade &>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%post servers
|
||||
/sbin/ldconfig
|
||||
@ -447,9 +470,17 @@ fi
|
||||
# It was created by the % pre above.
|
||||
if [ -f /var/lib/ldap/upgrade.ldif ] ; then
|
||||
/sbin/runuser -m -s /usr/sbin/slapadd -- "ldap" -l /var/lib/ldap/upgrade.ldif > /dev/null 2>&1
|
||||
rm /var/lib/ldap/upgrade.ldif
|
||||
rm -f /var/lib/ldap/upgrade.ldif
|
||||
fi
|
||||
exec > /dev/null 2> /dev/null
|
||||
|
||||
# If there's a /var/lib/ldap/need_db_upgrade file, run db_upgrade and delete it.
|
||||
# It was created by the % pre above.
|
||||
if [ -f /var/lib/ldap/need_db_upgrade ]; then
|
||||
/sbin/runuser -m -s /usr/sbin/slapd_db_upgrade -- "ldap" -h /var/lib/ldap /var/lib/ldap/*.bdb
|
||||
/sbin/runuser -m -s /usr/sbin/slapd_db_checkpoint -- "ldap" -h /var/lib/ldap -1
|
||||
rm -f /var/lib/ldap/need_db_upgrade
|
||||
fi
|
||||
|
||||
if [ ! -f %{_sysconfdir}/pki/tls/certs/slapd.pem ] ; then
|
||||
pushd %{_sysconfdir}/pki/tls/certs
|
||||
umask 077
|
||||
@ -466,6 +497,16 @@ chown root:ldap slapd.pem
|
||||
chmod 640 slapd.pem
|
||||
popd
|
||||
fi
|
||||
|
||||
if [ $1 -ge 1 ] ; then
|
||||
/sbin/service ldap condrestart &>/dev/null
|
||||
/sbin/service ldap status &>/dev/null
|
||||
if [ "$?" != "0" -a -f /var/lib/ldap/need_start ]; then
|
||||
/sbin/service ldap start &>/dev/null
|
||||
rm -f /var/lib/ldap/need_start &>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
%preun servers
|
||||
@ -481,9 +522,6 @@ fi
|
||||
|
||||
%postun servers
|
||||
/sbin/ldconfig
|
||||
if [ $1 -ge 1 ] ; then
|
||||
/sbin/service ldap condrestart > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post devel -p /sbin/ldconfig
|
||||
|
||||
@ -561,6 +599,11 @@ fi
|
||||
%attr(0644,root,root) %{evolution_connector_libdir}/*.a
|
||||
|
||||
%changelog
|
||||
* Thu Apr 10 2008 Jan Safranek <jsafranek@redhat.com> 2.4.8-4
|
||||
- bdb upgraded to 4.6.21
|
||||
- reworked upgrade logic again to run db_upgrade when bdb version
|
||||
changes
|
||||
|
||||
* Wed Mar 5 2008 Jan Safranek <jsafranek@redhat.com> 2.4.8-3
|
||||
- reworked the upgrade logic, slapcat/slapadd of the whole database
|
||||
is needed only if minor version changes (2.3.x -> 2.4.y)
|
||||
|
Loading…
Reference in New Issue
Block a user