#!/bin/bash

. /usr/lib/eole/libgpo
force=$2

if [ -x /usr/bin/CreoleGet ]; then
    # Scribe AD distant
    [ "$(CreoleGet ad_local oui)" = "non" ] && exit 0
    ldap_installed="$(CreoleGet openldap_installed oui)"
    if [ "$ldap_installed" = 'non' ] && [ ! "$force" ]; then
        exit 0
    fi
fi

GPO_NAME="eole_proxy"

if [ "$(CreoleGet gpo_proxy_active)" == "oui" ]
then
    samba_import_gpo_with_templating "$GPO_NAME"
else
    samba_delete_gpo "$GPO_NAME"
fi
exit 0
