- reworked the upgrade logic, slapcat/slapadd of the whole database is needed only if minor version changes (2.3.x -> 2.4.y)
- do not try to save database in LDIF format, if openldap-servers package is being removed (it's up to the admin to do so manually)
This commit is contained in:
parent
1c0049626b
commit
68c2fe40b8
@ -8,7 +8,7 @@
|
||||
Summary: The configuration files, libraries, and documentation for OpenLDAP
|
||||
Name: openldap
|
||||
Version: %{version}
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: OpenLDAP
|
||||
Group: System Environment/Daemons
|
||||
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
|
||||
@ -415,20 +415,27 @@ if /usr/sbin/useradd -c "LDAP User" -u 55 \
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# (the below is copied from the preun servers scriptlet below)
|
||||
# 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)
|
||||
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
|
||||
if [ -f /var/lib/ldap/upgrade.ldif ] ; then
|
||||
/bin/rm -fr /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
mkdir /var/lib/ldap/rpmorig
|
||||
mv /var/lib/ldap/{alock,*.bdb,__db.*,log.*} /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
cp -f /var/lib/ldap/DB_CONFIG /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
else
|
||||
/bin/rm -f /var/lib/ldap/upgrade.ldif
|
||||
|
||||
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
|
||||
# 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)
|
||||
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
|
||||
if [ -f /var/lib/ldap/upgrade.ldif ] ; then
|
||||
/bin/rm -fr /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
mkdir /var/lib/ldap/rpmorig
|
||||
mv /var/lib/ldap/{alock,*.bdb,__db.*,log.*} /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
cp -f /var/lib/ldap/DB_CONFIG /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
else
|
||||
/bin/rm -f /var/lib/ldap/upgrade.ldif
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -437,7 +444,7 @@ fi
|
||||
/sbin/ldconfig
|
||||
/sbin/chkconfig --add ldap
|
||||
# If there's a /var/lib/ldap/upgrade.ldif file, slapadd it and delete it.
|
||||
# It was created by the uninstall of the previous version.
|
||||
# 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
|
||||
@ -465,18 +472,11 @@ exit 0
|
||||
if [ "$1" = "0" ] ; then
|
||||
/sbin/service ldap stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del ldap
|
||||
# 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)
|
||||
files="/var/lib/ldap/log.* /var/lib/ldap/__db.* /var/lib/ldap/[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
|
||||
/bin/rm -fr /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
mkdir /var/lib/ldap/rpmorig
|
||||
mv /var/lib/ldap/{alock,*.bdb,__db.*,log.*} /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
cp -f /var/lib/ldap/DB_CONFIG /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
|
||||
fi
|
||||
fi
|
||||
# Openldap-servers are being removed from system.
|
||||
# Do not touch the database! Older versions of this
|
||||
# package attempted to store database in LDIF format, so
|
||||
# it can be restored later - but it's up to the administrator
|
||||
# to save the database, if he/she wants so.
|
||||
fi
|
||||
|
||||
%postun servers
|
||||
@ -561,6 +561,12 @@ fi
|
||||
%attr(0644,root,root) %{evolution_connector_libdir}/*.a
|
||||
|
||||
%changelog
|
||||
* 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)
|
||||
- do not try to save database in LDIF format, if openldap-servers package
|
||||
is being removed (it's up to the admin to do so manually)
|
||||
|
||||
* Thu Feb 28 2008 Jan Safranek <jsafranek@redhat.com> 2.4.8-2
|
||||
- migration tools carved out to standalone package "migrationtools"
|
||||
(#236697)
|
||||
|
Loading…
Reference in New Issue
Block a user