]> git.stg.codes - stg.git/blob - functest/clone.sh
f6c7b44bc100d461c43db58f06933ede75531683
[stg.git] / functest / clone.sh
1 #!/bin/sh
2
3 BASEPATH=$1
4 ARCHIVE=$2
5 CURPATH=`pwd`
6 GIT=/usr/bin/git
7 TAR=/bin/tar
8 RM=/bin/rm
9
10 if [ "$BASEPATH" == "" ]
11 then
12     printf "Usage: $0 <path>\n"
13     exit -1
14 fi
15
16 if [ ! -d "$BASEPATH" ]
17 then
18     printf "Path '$BASEPATH' does not exist or not a directory.\n"
19     exit -1
20 fi
21
22 $GIT clone "https://gitorious.org/stg/stg.git" "$BASEPATH/stg"
23
24 if [ "$ARCHIVE" != "" ]
25 then
26     $RM -rf "$BASEPATH/stg/.git"
27
28     $TAR -C "$BASEPATH" -jcf "$BASEPATH/stg.tar" "stg"
29 fi