Temporary fix on directory init for seth module

This commit is contained in:
Philippe Caseiro 2021-01-20 15:57:08 +01:00
parent 362e1e3e17
commit 87e015fd63
2 changed files with 74 additions and 0 deletions

69
postservice/91-cadolesldap Executable file
View File

@ -0,0 +1,69 @@
#!/bin/bash
#
# Initialisation of LDAP Directory
#
#
# Run command as particular user
#
function runAs() {
USER=${1}
shift
CMD="su ${USER} -s /bin/bash -c ${@}"
eval ${CMD}
return ${?}
}
function addLDAPschema()
{
LDIF="/etc/cadolesldap/init/cadolesldap.ldif"
USER="openldap"
CMD="\"slapadd -l ${LDIF} -f \"/etc/ldap/slapd.conf\"\""
service slapd stop
runAs ${USER} ${CMD}
result=$((result+${?}))
service slapd start
return ${result}
}
function addADSchema()
{
/usr/share/eole/sbin/cadoles_add_schema.sh
return ${?}
}
function main()
{
MODE=${1}
result=0
if [[ ${MODE} == "instance" ]]
then
if [[ $(CreoleGet eole_module) == "seth" ]]
then
addADSchema
return ${?}
else
addLDAPschema
return ${?}
fi
fi
}
if [[ $(CreoleGet eole_module eolebase) != "seth" ]]
then
exit 0
fi
if [[ $(CreoleGet activer_cadolesldap non) == "oui" ]]
then
main $@
exit ${?}
else
exit 0
fi

View File

@ -55,6 +55,11 @@ function main()
fi
}
if [[ $(CreoleGet eole_module eolebase) == "seth" ]]
then
exit 0
fi
if [[ $(CreoleGet activer_cadolesldap non) == "oui" ]]
then
main $@