# 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:" } # Remove a user from the server. This is a two-step process. user_del() { if run_gitano_as "$1" user del "$2" 2> "$DATADIR/temp" then secret=$(awk '{ s = $2 } END { print s }' "$DATADIR/temp") run_gitano_as "$1" user del "$2" "$secret" fi }