#!/bin/bash
#
# Usage: ldapPostInstall
#    Move /etc/openldap/ldap.conf to /tmp/ldap.conf.old if it has
#    the same content as ldap.conf.default which means LDAP has not been
#    configured on this HMC. (This is to prevent a pam_ldap bug that
#    leaves ldap.conf opened)
#

if [ -e /etc/openldap/ldap.conf ]
then
COUNT1=`wc /etc/openldap/ldap.conf | cut -c1-15`
COUNT2=`wc /etc/openldap/ldap.conf.default | cut -c1-15`
#echo $COUNT1
#echo $COUNT2
if [ "$COUNT1" == "$COUNT2" ]
then
    echo "LDAP is not configured yet. Clean up /etc/openldap/ldap.conf"
    mv /etc/openldap/ldap.conf /tmp/ldap.conf.old
else
    echo "LDAP has been configured."
fi
else
    echo "LDAP is not configured yet."
fi
