From: Valentin Vidic Date: Fri, 28 Mar 2008 15:23:04 +0000 (+0100) Subject: Fixes for ldap -> openldap user switch. X-Git-Tag: debian/4.0.1~12 X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=commitdiff_plain;h=b31f79b9c72b7e548ed2a1b8e1fc7308fdad19a0;p=carnet-upgrade.git Fixes for ldap -> openldap user switch. --- diff --git a/src/functions.sh b/src/functions.sh index 9c81fc8..33ac260 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -1,4 +1,3 @@ -# last update: 2005-07-03 # Ivan 'ico' Rako # Zoran 'jelly' Dzelajlija @@ -655,17 +654,35 @@ upgrade_amavis () { upgrade_openldap () { pkg openldap-aai lt 2.3 || return 0 + # openldap-aai expects org.ldif to exists + local ldif=/var/lib/ldap/org.ldif + local ldif_backup=/var/lib/carnet-upgrade/org.ldif + if [ -f $ldif ]; then + cp -v $ldif $ldif_backup + fi + # slapd postinst fails if move_old_database is false echo 'slapd slapd/move_old_database boolean true' | debconf-set-selections pkgadd slapd - # openldap-aai postinst fails here because of database permissions - if ! apt-get -y install openldap-aai; then - chown -R openldap:openldap /var/lib/ldap # fix slapd - /etc/init.d/slapd restart + # slapd removes org.ldif during switch from ldap -> openldap user + if [ -f $ldif_backup -a ! -f $ldif ]; then + cp -v $ldif_backup $ldif + fi - # try openldap-aai postinst again (also re-enables slurpd) - dpkg --configure -a + # openldap-aai postinst fails here because of database permissions + apt-get -y install openldap-aai || true + chown -R openldap:openldap /var/lib/ldap + /etc/init.d/slapd restart + dpkg --configure -a + + # remove ldap user if openldap works + if getent passwd ldap > /dev/null && \ + getent passwd openldap > /dev/null && \ + pgrep -U openldap slapd > /dev/null + then + log "userdel ldap (replaced by openldap)" + userdel ldap || true fi }