hg-ssh-wrapper
changeset 31 d54720d47ca2
parent 18 538d6b198f4a
equal deleted inserted replaced
30:98dbde5b13a1 31:d54720d47ca2
     1 #!/bin/sh
     1 #!/bin/sh
     2 
     2 
     3 # This file needs to be saved as ~/hg-ssh-wrapper for the user whose
     3 # This file should live in /etc/hg-admin-tools.  It expects
     4 # ~/.ssh/authorized_keys file is rewritten by refresh-auth.  It expects
       
     5 # to be specified as the target of the "command" section in the prefix
     4 # to be specified as the target of the "command" section in the prefix
     6 # of a key in the authorized_keys file, and be passed a name associated
     5 # of a key in the authorized_keys file, and be passed a name associated
     7 # with an ssh key as its only argument.  It does some setting up before
     6 # with an ssh key as its only argument.  It does some setting up before
     8 # calling hg-ssh, which does the real work of deciding whether to allow
     7 # calling hg-ssh, which does the real work of deciding whether to allow
     9 # the users action based on the type of the action, the key name, and
     8 # the users action based on the type of the action, the key name, and
    15 set -e
    14 set -e
    16 
    15 
    17 # Use a different hgrc for remote pulls - this way you can set
    16 # Use a different hgrc for remote pulls - this way you can set
    18 # up access.py for everything at once without affecting local operations
    17 # up access.py for everything at once without affecting local operations
    19 
    18 
    20 HGRCPATH=$(pwd)/remote-hgrc
    19 HGRCPATH=/etc/hg-admin-tools/remote-hgrc
    21 export HGRCPATH
    20 export HGRCPATH
    22 
    21 
    23 # Set up this environment variable - useful for hg hooks to check.
    22 # Set up this environment variable - useful for hg hooks to check.
    24 REMOTE_USER=$1
    23 REMOTE_USER=$1
    25 export REMOTE_USER
    24 export REMOTE_USER
    26 
    25 
    27 cd repos
    26 cd repos
    28 HG_ACCESS_RULES_FILE=$(pwd)/hgadmin/hg-ssh-access.conf
    27 HG_ACCESS_RULES_FILE=$(pwd)/hgadmin/hg-ssh-access.conf
    29 export HG_ACCESS_RULES_FILE
    28 export HG_ACCESS_RULES_FILE
    30 exec ../admin/hg-admin-tools/hg-ssh 
    29 exec /usr/local/lib/hg-admin-tools/hg-ssh
       
    30