src/init/conf/hg-ssh-wrapper
author Paul Crowley <paul@lshift.net>
Fri, 20 Feb 2009 14:29:48 +0000
changeset 51 d87eeeae29a5
parent 50 77d97aa18f29
child 62 f1e319d3672a
permissions -rwxr-xr-x
Use the context API

#!/bin/sh
# Copyright 2008-2009 LShift Ltd

# This file should live in /etc/mercurial-server.  It expects
# to be specified as the target of the "command" section in the prefix
# of a key in the authorized_keys file, and be passed a name associated
# with an ssh key as its only argument.  It does some setting up before
# calling hg-ssh, which does the real work of deciding whether to allow
# the users action based on the type of the action, the key name, and
# the contents of the specified rules file.

# If your repository is laid out differently you may need to modify
# this file.

set -e

# Use a different hgrc for remote pulls - this way you can set
# up access.py for everything at once without affecting local operations

HGRCPATH=/etc/mercurial-server/remote-hgrc
export HGRCPATH

# Set up this environment variable - useful for hg hooks to check.
REMOTE_USER=$1
export REMOTE_USER

cd repos
HG_ACCESS_RULES_PATH=/etc/mercurial-server/access.conf:$(pwd)/hgadmin/access.conf
export HG_ACCESS_RULES_PATH
exec /usr/local/lib/mercurial-server/hg-ssh