eole-lemonldap/posttemplate/70-lemonldap-ng-hosts
2020-10-14 13:52:41 +02:00

22 lines
510 B
Bash
Executable File

#!/bin/bash
# Don't run on ScribeAD
[ ! -f /usr/lib/eole/eolead.sh ] || exit 0
ENABLE=$(CreoleGet activerLemon 'non')
HOSTS="/etc/hosts"
if [ "${ENABLE}" = 'oui' ];then
manager=$(CreoleGet managerWebName)
handler=$(CreoleGet reloadWebName)
portal=$(CreoleGet authWebName)
ipaddr=$(CreoleGet adresse_ip_eth0)
line="${ipaddr} ${manager} ${handler} ${portal}"
grep -q "${line}" ${HOSTS}
if [[ ${?} -eq 0 ]]
then
exit 0
else
echo ${line} >> ${HOSTS}
fi
fi