src/refresh-auth
author Paul Crowley <paul@lshift.net>
Wed, 07 Sep 2011 10:41:21 +0100
branchdebian
changeset 325 ed581082bb66
parent 242 03d8f07230b3
permissions -rwxr-xr-x
Merge default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
9fac559c3d55 don't assume Python path for refresh-auth
Paul Crowley <paul@ciphergoth.org>
parents: 15
diff changeset
     1
#!/usr/bin/env python
242
03d8f07230b3 Tidy up file prologues; move credits to CREDITS
Paul Crowley <paul@lshift.net>
parents: 217
diff changeset
     2
"""
03d8f07230b3 Tidy up file prologues; move credits to CREDITS
Paul Crowley <paul@lshift.net>
parents: 217
diff changeset
     3
Rewrite ~/.ssh/authorized_keys by recursing through key directories
03d8f07230b3 Tidy up file prologues; move credits to CREDITS
Paul Crowley <paul@lshift.net>
parents: 217
diff changeset
     4
"""
3
7e659a6870de make more robus and less crufty
Paul Crowley <paul@lshift.net>
parents: 1
diff changeset
     5
4
dcd195f3e52c move config out of Python files; don't make hg-ssh-wrapper a dotfile;
Paul Crowley <paul@lshift.net>
parents: 3
diff changeset
     6
import sys
86
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
     7
import os
211
0cd59649772c Rename paths.py ot config.py
Paul Crowley <paul@lshift.net>
parents: 165
diff changeset
     8
from mercurialserver import refreshauth, config
0
41ecb5a3172c separate out executables and data
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     9
73
5d81ec164e5d do-refresh-auth now does all the work
Paul Crowley <paul@lshift.net>
parents: 67
diff changeset
    10
if len(sys.argv) != 1:
5d81ec164e5d do-refresh-auth now does all the work
Paul Crowley <paul@lshift.net>
parents: 67
diff changeset
    11
    sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
4
dcd195f3e52c move config out of Python files; don't make hg-ssh-wrapper a dotfile;
Paul Crowley <paul@lshift.net>
parents: 3
diff changeset
    12
    sys.exit(-1)
dcd195f3e52c move config out of Python files; don't make hg-ssh-wrapper a dotfile;
Paul Crowley <paul@lshift.net>
parents: 3
diff changeset
    13
217
32b431977bf9 Fix /home/paul if it's broken when we start
Paul Crowley <paul@lshift.net>
parents: 211
diff changeset
    14
config.initExe()
32b431977bf9 Fix /home/paul if it's broken when we start
Paul Crowley <paul@lshift.net>
parents: 211
diff changeset
    15
165
3606d60b07e5 Use .mercurial-sever file instead of hardcoding
Paul Crowley <paul@lshift.net>
parents: 86
diff changeset
    16
# To protect the authorized_keys file for innocent users, you have to have
3606d60b07e5 Use .mercurial-sever file instead of hardcoding
Paul Crowley <paul@lshift.net>
parents: 86
diff changeset
    17
# a ~/.mercurial-server file to run this.
211
0cd59649772c Rename paths.py ot config.py
Paul Crowley <paul@lshift.net>
parents: 165
diff changeset
    18
if not config.configExists():
86
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    19
    print >>sys.stderr, "Must be run as the 'hg' user"
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    20
    sys.exit(-1)
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    21
165
3606d60b07e5 Use .mercurial-sever file instead of hardcoding
Paul Crowley <paul@lshift.net>
parents: 86
diff changeset
    22
refreshauth.refreshAuth()