#!/bin/bash
. /usr/lib/eole/ihm.sh

# On désactive le service ipsec qui est géré par bastion
if [ -L /etc/rc3.d/S*ipsec ]
then
    update-rc.d -f ipsec remove >/dev/null
fi
install_rvp=$(CreoleGet install_rvp)
type_amon=$(CreoleGet type_amon '')
if [ "$install_rvp" = "non" ]
then
    # ipsec est inutile (#1937)
    /etc/init.d/ipsec stop &>/dev/null
elif [ "${type_amon}" != "" ]
then
    if [ "$1" = "instance" ]
    then
        ## Mise en place du VPN ##
        echo
        Question_ouinon "Voulez-vous (re)configurer le Réseau Virtuel Privé maintenant ?" "True" "non"
        if [ $? -eq 0 ];then
            /usr/share/eole/sbin/active_rvp init
        fi
        echo
    fi
fi

# On vide le cache CRL strongSwan (#15970)
# Il sera recréé au lancement du service
CRL_CACHE_DIR="/etc/ipsec.d/crls"
if [ -d $CRL_CACHE_DIR ]
then
    rm -f $CRL_CACHE_DIR/* >> /dev/null 2>&1
fi

exit 0
