# HG changeset patch # User Paul Crowley # Date 1258130374 0 # Node ID 32b431977bf9de141f5f82e04c549347338ad527 # Parent 0122df83ebd007ee03191669867f7c7471509f0f Fix /home/paul if it's broken when we start diff -r 0122df83ebd0 -r 32b431977bf9 src/hg-ssh --- a/src/hg-ssh Fri Nov 13 14:58:55 2009 +0000 +++ b/src/hg-ssh Fri Nov 13 16:39:34 2009 +0000 @@ -67,7 +67,7 @@ checkParents(repo) return repo -config.setExePath() +config.initExe() if len(sys.argv) == 3 and sys.argv[1] == "--base64": ruleset.rules.set(user = base64.b64decode(sys.argv[2])) diff -r 0122df83ebd0 -r 32b431977bf9 src/mercurialserver/config.py --- a/src/mercurialserver/config.py Fri Nov 13 14:58:55 2009 +0000 +++ b/src/mercurialserver/config.py Fri Nov 13 16:39:34 2009 +0000 @@ -1,7 +1,9 @@ # Copyright 2008-2009 LShift Ltd import sys +import os import os.path +import pwd import ConfigParser globalconfig = None @@ -36,9 +38,11 @@ def getEnv(): return _getConf().items("env") # Work out where we are, don't use config. -def setExePath(): +def initExe(): global _exePath _exePath = os.path.dirname(os.path.abspath(sys.argv[0])) + # Fix $HOME in case of "sudo -u hg refresh-auth" + os.environ['HOME'] = pwd.getpwuid(os.geteuid()).pw_dir def getExePath(): return _exePath diff -r 0122df83ebd0 -r 32b431977bf9 src/refresh-auth --- a/src/refresh-auth Fri Nov 13 14:58:55 2009 +0000 +++ b/src/refresh-auth Fri Nov 13 16:39:34 2009 +0000 @@ -14,11 +14,12 @@ sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv) sys.exit(-1) +config.initExe() + # To protect the authorized_keys file for innocent users, you have to have # a ~/.mercurial-server file to run this. if not config.configExists(): print >>sys.stderr, "Must be run as the 'hg' user" sys.exit(-1) -config.setExePath() refreshauth.refreshAuth()