-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.sh
34 lines (27 loc) · 953 Bytes
/
template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#/bin/sh
#FUPGRB Fast Update Program from Github and Run it in Bash
#This is template file, only check internet connecton ;)
cd /path/to/data #on this line write the path to the cloned repository folder
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
if [ $? -eq 0 ];
then
git fetch
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ];
then
echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
echo "Updating..."
git pull
echo "Rebuilding..."
#Below this line write the recompilation code
#Above this line write the recompilation code
fi;
else
echo "Offline"
fi
#Below this line write the run code
#Above this line write the run code