summaryrefslogtreecommitdiffstats
path: root/roles/batcave/files/syncgittree.sh
blob: 7943b2222443a0baba4becd02c568e200271359e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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