summaryrefslogtreecommitdiff
path: root/git.liw.fi.sh
blob: 6f1163c17526b2ef457737d804356aec14eb2cfd (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
gitano()
{
    local keyname="$1"
    shift
    if [ "$keyname" = "liw" ]
    then
	ssh "$GITANO" "$@"
    else
	SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$keyname.key" "$GITANO" "$@"
    fi
}

die()
{
    echo "$@" 1>&2
    exit 1
}

attempt()
{
    if "$@" > "$DATADIR/attempt.stdout" 2> "$DATADIR/attempt.stderr"
    then
	echo 0 > "$DATADIR/attempt.exit"
    else
	echo $? > "$DATADIR/attempt.exit"
    fi
}

clone_using_git()
{
    local dir="$1/$2"
    local url="git://$GITHOST/$2"
    rm -rf "$dir"
    mkdir -p "$dir"
    if [ "$1" = liw ]
    then
	git clone "$url" "$dir"
    else
	SSH_AUTH_SOCK= git clone "$url" "$dir"
    fi
}

clone_using_ssh()
{
    local dir="$1/$2"
    local url="ssh://$GITANO/$2"
    rm -rf "$dir"
    mkdir -p "$dir"
    if [ "$1" = liw ]
    then
	git clone "$url" "$dir"
    else
	PATH="$SRCDIR:$PATH" git clone "$url" "$dir"
    fi
}