#!/bin/bash

force=$2

. /usr/lib/eole/libgpo

ACTIVER_EOLE_GPOS=$(CreoleGet activer_eole_gpos)
if [ "$ACTIVER_EOLE_GPOS" != "oui" ]
then
    echo "Pas de GPO EOLE d'après genconfig"
    exit 0
fi
samba_delete_gpos
samba_import_gpos_with_templating
samba_link_gpos

if [ -z "$(CreoleGet ad_address "")" ];
then
    # Seth - AmonEcole
    CreoleRun "manage-gpo-eole workaround_policies" addc
    CreoleRun "manage-gpo-eole workaround_sysvol" addc
else
    # Scribe
    lxc-attach -n addc -- manage-gpo-eole workaround_policies
    lxc-attach -n addc -- manage-gpo-eole workaround_sysvol
fi

exit 0

