first commit
This commit is contained in:
42
posttemplate/91-cadolesldap
Executable file
42
posttemplate/91-cadolesldap
Executable file
@ -0,0 +1,42 @@
|
||||
#!/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 main()
|
||||
{
|
||||
MODE=${1}
|
||||
|
||||
result=0
|
||||
|
||||
|
||||
if [[ ${MODE} == "instance" ]]
|
||||
then
|
||||
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}
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
||||
exit ${?}
|
Reference in New Issue
Block a user