#!/bin/bash
. /usr/lib/eole/ihm.sh
UPSTART_STRONGSWAN="strongswan"

# On désactive le service ipsec qui est géré par bastion
if [ -f "/etc/init/${UPSTART_STRONGSWAN}.conf" ]
then
    mv /etc/init/${UPSTART_STRONGSWAN}.conf /etc/init/${UPSTART_STRONGSWAN}.conf.disabled >/dev/null
fi
install_rvp=$(CreoleGet install_rvp)
type_amon=$(CreoleGet type_amon '')
if [ "$install_rvp" = "non" ]
then
    # ipsec est inutile (#1937)
    service $UPSTART_STRONGSWAN 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

exit 0
