#!/bin/bash

if [ -x /usr/bin/CreoleGet ]; then
    [ "$(CreoleGet ad_local)" = 'oui' ] || exit 0
fi

# Do not use agent for connections in the container
unset SSH_AUTH_SOCK

option=$1
force=$2

if [ "$(CreoleGet openldap_installed oui)" = 'non' ]; then
    if [ ! $force ]; then
        exit 0
    fi
    CreoleRun "/usr/share/eole/samba/30-gposcript $option $force" domaine
else
    lxc-attach -n addc -- /usr/share/eole/samba/30-gposcript
fi

# Create logon script files for network drives mapping
[ -x /usr/share/eole/sbin/special_shares.sh ] && /usr/share/eole/sbin/special_shares.sh

exit 0
