Revision 5e4b99a5
Added by Alexis Mousset about 7 years ago
rudder-inventory-ldap/SPECS/rudder-inventory-ldap.spec | ||
---|---|---|
/opt/rudder/sbin/slapcat -b "cn=rudder-configuration" -l /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.ldif
|
||
|
||
# Store version of libdb used to make this backup
|
||
echo $(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1) > /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version
|
||
|
||
if [ -f /var/rudder/ldap/openldap-data/objectClass.bdb ]
|
||
then
|
||
echo $(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1) > /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version
|
||
fi
|
||
fi
|
||
|
||
%post -n rudder-inventory-ldap
|
||
... | ... | |
# we may need to drop and reimport the database if the underlying version
|
||
# of libdb has changed.
|
||
if [ -f "/var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version" ]; then
|
||
# Did the underlying version of libdb change?
|
||
current_libdb_version=$(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1)
|
||
previous_libdb_version=$(cat /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version)
|
||
if [ "${current_libdb_version}" != "${previous_libdb_version}" ]; then
|
||
# OK, we need to remove the old DB and import the backup
|
||
REINIT_DB="yes"
|
||
fi
|
||
fi
|
||
|
||
if [ "${REINIT_DB}" = "yes" ]; then
|
||
# OK, we need to remove the old DB and import the backup
|
||
|
||
# Do we have a database backup to restore from?
|
||
if [ ! -f ${BACKUP_LDIF} ]; then
|
rudder-inventory-ldap/debian/postinst | ||
---|---|---|
# we may need to drop and reimport the database if the underlying version
|
||
# of libdb has changed.
|
||
if [ -f "/var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version" ]; then
|
||
# Did the underlying version of libdb change?
|
||
current_libdb_version=$(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1)
|
||
previous_libdb_version=$(cat /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version)
|
||
if [ "${current_libdb_version}" != "${previous_libdb_version}" ]; then
|
||
# OK, we need to remove the old DB and import the backup
|
||
REINIT_DB="yes"
|
||
fi
|
||
fi
|
||
|
||
if [ "${REINIT_DB}" = "yes" ]; then
|
||
# OK, we need to remove the old DB and import the backup
|
||
|
||
# Do we have a database backup to restore from?
|
||
if [ ! -f ${BACKUP_LDIF} ]; then
|
rudder-inventory-ldap/debian/preinst | ||
---|---|---|
/opt/rudder/sbin/slapcat -b "cn=rudder-configuration" -l /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.ldif
|
||
|
||
# Store version of libdb used to make this backup
|
||
echo $(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1) > /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version
|
||
if [ -f /var/rudder/ldap/openldap-data/objectClass.bdb ]
|
||
then
|
||
echo $(ldd /opt/rudder/sbin/slapcat | grep libdb | cut -d"=" -f1) > /var/rudder/ldap/backup/openldap-data-pre-upgrade-${TIMESTAMP}.libdb-version
|
||
fi
|
||
;;
|
||
|
||
install)
|
Also available in: Unified diff
Fixes #10517: Error when upgrading on Ubuntu16 from 4.0 to 4.1