summaryrefslogtreecommitdiff
path: root/git.liw.fi.sh
blob: f4245f186cc94f71f9c0f2f3c49c719c1f5f7de2 (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
# Shell library for running git.liw.fi ACL tests.


# This is handy for giving an error message and aborting.

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


# Run gitano on the server using a desired ssh key. The key is
# either the admin key (i.e., they key of whoever invoked the
# test suite), or a test key we've created in $DATADIR.

run_gitano_as()
{
    local keyname="$1"
    shift
    if [ "$keyname" = "admin" ]
    then
	ssh "$GITANO@$GITHOST" "$@"
    else
	SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$DATADIR/$keyname.key" \
	    "$GITANO@GITHOST" "$@"
    fi
}


# Does a user exist on the server?

user_exists()
{
    ssh "$GITANO@$GITHOST" user | grep "^$1:"
}