parent
82b8ccaded
commit
40bc33f600
@ -400,14 +400,14 @@ fi
|
||||
|
||||
# upgrade
|
||||
if [ $1 -eq 2 ]; then
|
||||
# safe way to migrate the database if minor version number changed (2.x -> 2.y)
|
||||
# safe way to migrate the database if version number changed
|
||||
# http://www.openldap.org/doc/admin24/maintenance.html
|
||||
|
||||
old_version=$(rpm -q --qf=%%{version} openldap-servers | sed 's/\.[0-9]*$//')
|
||||
new_version=$(sed 's/\.[0-9]*$//' <<< %{version})
|
||||
old_version=$(rpm -q --qf=%%{version} openldap-servers)
|
||||
new_version=%{version}
|
||||
|
||||
if [ "$old_version" != "$new_version" ]; then
|
||||
pushd %{_sharedstatedir}/ldap
|
||||
pushd %{_sharedstatedir}/ldap &>/dev/null
|
||||
|
||||
# stop the service
|
||||
if service slapd status &>/dev/null; then
|
||||
@ -417,7 +417,7 @@ if [ $1 -eq 2 ]; then
|
||||
rm -f need_start
|
||||
fi
|
||||
|
||||
if ls __db.* &>/dev/null; then
|
||||
if ls *.bdb &>/dev/null; then
|
||||
# export the database
|
||||
if [ -f %{_sysconfdir}/openldap/slapd.conf ]; then
|
||||
slapcat -f %{_sysconfdir}/openldap/slapd.conf -l upgrade.ldif &>/dev/null
|
||||
@ -427,15 +427,21 @@ if [ $1 -eq 2 ]; then
|
||||
|
||||
# backup the old database
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -rf rpmorig
|
||||
mv alock *.bdb __db.* log.* rpmorig &>/dev/null || :
|
||||
cp -f rpmorig/DB_CONFIG . &>/dev/null || :
|
||||
chown ldap:ldap upgrade.ldif
|
||||
chmod 0400 upgrade.ldif
|
||||
|
||||
rm -rf backup
|
||||
mkdir -m 0700 backup
|
||||
chown 0500 backup
|
||||
|
||||
mv alock *.bdb __db.* log.* backup &>/dev/null
|
||||
cp -f backup/DB_CONFIG DB_CONFIG &>/dev/null
|
||||
else
|
||||
rm -f upgrade.ldif
|
||||
fi
|
||||
fi
|
||||
|
||||
popd
|
||||
popd &>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -500,8 +506,8 @@ fi
|
||||
|
||||
# finish database migration (see %pre)
|
||||
if [ -f %{_sharedstatedir}/ldap/upgrade.ldif ]; then
|
||||
runuser -m -s /usr/sbin/slapadd -- ldap -l %{_sharedstatedir}/ldap/upgrade.ldif &>/dev/null
|
||||
rm -f %{_sharedstatedir}/ldap/upgrade.ldif
|
||||
runuser -m -s /usr/sbin/slapadd -- ldap -q -l %{_sharedstatedir}/ldap/upgrade.ldif >/dev/null
|
||||
mv -f %{_sharedstatedir}/ldap/upgrade.ldif %{_sharedstatedir}/ldap/backup.ldif
|
||||
fi
|
||||
|
||||
# restart after upgrade
|
||||
@ -536,7 +542,7 @@ fi
|
||||
|
||||
# db4 upgrade (see %triggerun)
|
||||
if [ $2 -eq 2 ]; then
|
||||
pushd %{_sharedstatedir}/ldap
|
||||
pushd %{_sharedstatedir}/ldap &>/dev/null
|
||||
|
||||
# we are interested in minor version changes (both versions of db4 are installed at this moment)
|
||||
if [ "$(rpm -q --qf="%%{version}\n" db4 | sed 's/\.[0-9]*$//' | sort -u | wc -l)" != "1" ]; then
|
||||
@ -555,7 +561,7 @@ if [ $2 -eq 2 ]; then
|
||||
rm -f upgrade_db4
|
||||
fi
|
||||
|
||||
popd
|
||||
popd &>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@ -564,7 +570,7 @@ exit 0
|
||||
|
||||
# db4 upgrade (see %triggerin)
|
||||
if [ -f %{_sharedstatedir}/ldap/upgrade_db4 ]; then
|
||||
pushd %{_sharedstatedir}/ldap
|
||||
pushd %{_sharedstatedir}/ldap &>/dev/null
|
||||
|
||||
# perform the upgrade
|
||||
if ls *.bdb &>/dev/null; then
|
||||
@ -579,7 +585,7 @@ if [ -f %{_sharedstatedir}/ldap/upgrade_db4 ]; then
|
||||
fi
|
||||
|
||||
rm -f upgrade_db4
|
||||
popd
|
||||
popd &>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@ -658,6 +664,7 @@ exit 0
|
||||
- Mozilla NSS - implement full non-blocking semantics
|
||||
ldapsearch -Z hangs server if starttls fails (#652822)
|
||||
- updated list of all overlays in slapd.conf (#655899)
|
||||
- fix database upgrade process (#656257)
|
||||
|
||||
* Thu Nov 18 2010 Jan Vcelak <jvcelak@redhat.com> 2.4.23-3
|
||||
- add support for multiple prefixed Mozilla NSS database files in TLS_CACERTDIR
|
||||
|
Loading…
Reference in New Issue
Block a user