src/refresh-auth
author Paul Crowley <paul@lshift.net>
Sat, 07 Mar 2009 09:55:01 +0000
changeset 86 78777f509303
parent 79 3a58a95fae2f
child 165 3606d60b07e5
permissions -rwxr-xr-x
Move check for hg user where it belongs

#!/usr/bin/env python
# Copyright 2008-2009 LShift Ltd

# WARNING
# This script completely destroys your ~/.ssh/authorized_keys
# file every time it is run
# WARNING

import sys
import os
import pwd
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)

pentry = pwd.getpwuid(os.geteuid())
if pentry.pw_name != "hg":
    # FIXME: re-execute
    print >>sys.stderr, "Must be run as the 'hg' user"
    sys.exit(-1)

paths.setExePath()

refreshauth.refreshAuth(pentry.pw_dir)