support de wget

fallback en cas d'absence de curl et wget
This commit is contained in:
Jephté Clain 2013-12-04 16:39:52 +04:00
parent 9d37d7253a
commit ca5ac77aec
1 changed files with 23 additions and 2 deletions

View File

@ -7,10 +7,31 @@ PRIV_REPO=http://vcs.univ.run/anongit/modules/nutools.git
PUB_REPO=http://vcs.univ-reunion.fr/anongit/modules/nutools.git
NAME=nutools
if curl -fs "$PRIV_REPO" >&/dev/null; then
REPO="$PRIV_REPO"
################################################################################
CURL="$(which curl 2>/dev/null)"
WGET="$(which wget 2>/dev/null)"
if [ -n "$NUTOOLS_REPO" ]; then
REPO="$NUTOOLS_REPO"
elif [ -n "$CURL" ]; then
if curl -fs "$PRIV_REPO" >&/dev/null; then
REPO="$PRIV_REPO"
else
REPO="$PUB_REPO"
fi
elif [ -n "$WGET" ]; then
if wget -q -O - "$PRIV_REPO" >&/dev/null; then
REPO="$PRIV_REPO"
else
REPO="$PUB_REPO"
fi
else
REPO="$PUB_REPO"
echo "\
WARN: impossible de déterminer la source pour la mise à jour.
sélection de l'adresse publique $PUB_REPO"
echo "\
NOTE: si une erreur se produit, utiliser l'adresse privée, e.g.
NUTOOLS_REPO=$PRIV_REPO $0"
fi
if [ $# -ne 1 -o "$1" != --do-update ]; then