# HG changeset patch # User Paul Crowley # Date 1236346890 0 # Node ID 3a58a95fae2fcf1771b2c74c59a8671ec22bcef5 # Parent 2a3407a146540671a0fadc7cd87ddfbeb00d09f7 abolish hg-ssh-wrapper diff -r 2a3407a14654 -r 3a58a95fae2f doc/PLAN --- a/doc/PLAN Fri Mar 06 13:30:37 2009 +0000 +++ b/doc/PLAN Fri Mar 06 13:41:30 2009 +0000 @@ -10,10 +10,10 @@ - give that module a hook, and call the hook instead of the exe - abolish refresh-auth shell script and rename do-refresh-auth to refresh-auth - replace env vars with Python globals +- change refresh-auth to refer to hg-ssh directly, abolish hg-ssh-wrapper Todo: -- change refresh-auth to refer to hg-ssh directly, abolish hg-ssh-wrapper - add comment check and -f flag to refresh-auth - change install script to a Python script, abolishing hginit diff -r 2a3407a14654 -r 3a58a95fae2f install --- a/install Fri Mar 06 13:30:37 2009 +0000 +++ b/install Fri Mar 06 13:41:30 2009 +0000 @@ -21,8 +21,6 @@ install -o root -g root -t /usr/local/lib/mercurial-server/init -m 644 \ src/init/hgadmin-hgrc install -o root -g root -d /etc/mercurial-server -install -o root -g root -t /etc/mercurial-server \ - src/init/conf/hg-ssh-wrapper install -o root -g root -t /etc/mercurial-server -m 644 \ src/init/conf/remote-hgrc \ src/init/conf/access.conf diff -r 2a3407a14654 -r 3a58a95fae2f src/hg-ssh --- a/src/hg-ssh Fri Mar 06 13:30:37 2009 +0000 +++ b/src/hg-ssh Fri Mar 06 13:41:30 2009 +0000 @@ -70,6 +70,7 @@ fail("hg-ssh must have exactly one argument (%s)" % sys.argv) +paths.setExePath() ruleset.rules.set(user = sys.argv[1]) # Use a different hgrc for remote pulls - this way you can set diff -r 2a3407a14654 -r 3a58a95fae2f src/init/conf/hg-ssh-wrapper --- a/src/init/conf/hg-ssh-wrapper Fri Mar 06 13:30:37 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#!/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. - -set -e -exec /usr/local/lib/mercurial-server/hg-ssh $1 diff -r 2a3407a14654 -r 3a58a95fae2f src/mercurialserver/paths.py --- a/src/mercurialserver/paths.py Fri Mar 06 13:30:37 2009 +0000 +++ b/src/mercurialserver/paths.py Fri Mar 06 13:41:30 2009 +0000 @@ -2,5 +2,15 @@ # Crude but it will do +import sys +import os.path + +def setExePath(): + global _exePath + _exePath = os.path.dirname(os.path.abspath(sys.argv[0])) + +def getExePath(): + return _exePath + def getEtcPath(): return "/etc/mercurial-server" diff -r 2a3407a14654 -r 3a58a95fae2f src/mercurialserver/refreshauth.py --- a/src/mercurialserver/refreshauth.py Fri Mar 06 13:30:37 2009 +0000 +++ b/src/mercurialserver/refreshauth.py Fri Mar 06 13:41:30 2009 +0000 @@ -19,7 +19,7 @@ print >>sys.stderr, "Must be run as the 'hg' user" akeyfile = pentry.pw_dir + "/.ssh/authorized_keys" - wrappercommand = paths.getEtcPath() + "/hg-ssh-wrapper" + wrappercommand = paths.getExePath() + "/hg-ssh" keydirs = [paths.getEtcPath() + "/keys", pentry.pw_dir + "/repos/hgadmin/keys"] prefix='no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command=' diff -r 2a3407a14654 -r 3a58a95fae2f src/refresh-auth --- a/src/refresh-auth Fri Mar 06 13:30:37 2009 +0000 +++ b/src/refresh-auth Fri Mar 06 13:41:30 2009 +0000 @@ -7,10 +7,12 @@ # WARNING import sys -from mercurialserver import refreshauth +from mercurialserver import refreshauth, paths if len(sys.argv) != 1: sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv) sys.exit(-1) +paths.setExePath() + refreshauth.refreshAuth()