ansible/roles/batcave/files/syncgittree.sh
Patrick Uiterwijk 923f8e22fc Someone is leaking GIT_DIR env
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-11-01 09:43:02 +00:00

24 lines
319 B
Bash
Executable file

#!/bin/bash
if [[ $UID != 0 ]]
then
echo "$0 must be run as root (sudo)"
exit 1
fi
echo
echo "Updating $1 into $2 for production"
echo
src="$1"
dest="$2"
if [ -d $dest/.git ]; then
cd $dest
unset GIT_DIR
/usr/bin/git pull 2>&1
else
/usr/bin/git clone $src $dest 2>&1 | sed 's/^/ /'
fi
echo