#! /bin/sh

# defaults, which are overriden in /etc/kwartz-cloud.conf or other files
SERVER_IP=kwartz.lyceejeanbart.fr
ALT_IP=serveur.lycee.jb
TLS_PORT=8443
DAVPATH=owncloud/remote.php/webdav

for conf in /etc/kwartz-cloud.conf ~/.kwartz-cloud.conf ./kwartz-cloud.conf; do
    if [ -f "$conf" ]; then
	. "$conf"
    fi
done

USER=$(zenity --title "Nom d'utilisateur ?" --entry --text "Nom d'utilisateur pour le Cloud du lycée")

if host ${ALT_IP} > /dev/null 2>&1; then
    CLOUD=${ALT_IP}:${TLS_PORT}/${DAVPATH}
else
    CLOUD=${SERVER_IP}:${TLS_PORT}/${DAVPATH}
fi

(nemo davs://${USER}@${CLOUD} &)

