#!/bin/bash

if [[ -e /usr/bin/lxc-ls ]] && [[ -e /var/lib/lxc/addc/config ]]
then
	lxc-update-config -c /var/lib/lxc/addc/config
fi

# Remove Samba4 DNS from container nameserver
# https://dev-eole.ac-dijon.fr/issues/28866

if [ -f /usr/lib/eole/eolead.sh ]
then
    . /usr/lib/eole/eolead.sh
else
    exit 0
fi

if [ -f ${CONTAINER_ROOTFS}/etc/eole/samba4-vars.conf ]
then
    . ${CONTAINER_ROOTFS}/etc/eole/samba4-vars.conf
else
    exit 0
fi

if [ -f ${CONTAINER_ROOTFS}/etc/resolv.conf ]
then
    sed -i -e "/${AD_HOST_IP}/d" ${CONTAINER_ROOTFS}/etc/resolv.conf
fi

exit 0
