nutools/update-nutools

34 lines
789 B
Plaintext
Raw Normal View History

2013-10-24 16:03:50 +04:00
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
2013-10-28 14:33:14 +04:00
SCRIPTNAME=update-nutools
TMPSCRIPT="/tmp/$SCRIPTNAME"
PRIV_REPO=http://vcs.univ.run/anongit/modules/nutools.git
PUB_REPO=http://vcs.univ-reunion.fr/anongit/modules/nutools.git
2013-10-24 16:03:50 +04:00
NAME=nutools
if curl -fs "$PRIV_REPO" >&/dev/null; then
REPO="$PRIV_REPO"
else
REPO="$PUB_REPO"
fi
2013-10-24 16:03:50 +04:00
if [ $# -ne 1 -o "$1" != --do-update ]; then
2013-10-28 14:33:14 +04:00
cp "$0" "$TMPSCRIPT"
2013-10-24 16:03:50 +04:00
chmod 755 "$TMPSCRIPT"
exec bash "$TMPSCRIPT" --do-update
fi
cd /tmp
rm -rf "$NAME"
git clone "$REPO" || exit 1
cd "$NAME"
2013-10-28 14:33:14 +04:00
if ! diff -q "$SCRIPTNAME" "$0"; then
echo "NOTE: Le script $SCRIPTNAME a été mis à jour. Il va être relancé."
2013-10-28 14:33:14 +04:00
exec bash "./$SCRIPTNAME"
fi
bash ./uinst -y || exit 1
cd ..
rm -rf "$NAME"
2013-11-13 20:36:07 +04:00
rm "$0"; exit 0