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
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
50
77d97aa18f29 update dates and copyright notices
Paul Crowley <paul@lshift.net>
parents: 42
diff changeset
     2
# Copyright 2008-2009 LShift Ltd
0
41ecb5a3172c separate out executables and data
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     3
3
7e659a6870de make more robus and less crufty
Paul Crowley <paul@lshift.net>
parents: 1
diff changeset
     4
# WARNING
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
     5
# This script completely destroys your ~/.ssh/authorized_keys
3
7e659a6870de make more robus and less crufty
Paul Crowley <paul@lshift.net>
parents: 1
diff changeset
     6
# file every time it is run
7e659a6870de make more robus and less crufty
Paul Crowley <paul@lshift.net>
parents: 1
diff changeset
     7
# WARNING
7e659a6870de make more robus and less crufty
Paul Crowley <paul@lshift.net>
parents: 1
diff changeset
     8
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
     9
import sys
86
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    10
import os
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    11
import pwd
79
3a58a95fae2f abolish hg-ssh-wrapper
Paul Crowley <paul@lshift.net>
parents: 76
diff changeset
    12
from mercurialserver import refreshauth, paths
0
41ecb5a3172c separate out executables and data
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    13
73
5d81ec164e5d do-refresh-auth now does all the work
Paul Crowley <paul@lshift.net>
parents: 67
diff changeset
    14
if len(sys.argv) != 1:
5d81ec164e5d do-refresh-auth now does all the work
Paul Crowley <paul@lshift.net>
parents: 67
diff changeset
    15
    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
    16
    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
    17
86
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    18
pentry = pwd.getpwuid(os.geteuid())
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    19
if pentry.pw_name != "hg":
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    20
    # FIXME: re-execute
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    21
    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
    22
    sys.exit(-1)
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    23
79
3a58a95fae2f abolish hg-ssh-wrapper
Paul Crowley <paul@lshift.net>
parents: 76
diff changeset
    24
paths.setExePath()
3a58a95fae2f abolish hg-ssh-wrapper
Paul Crowley <paul@lshift.net>
parents: 76
diff changeset
    25
86
78777f509303 Move check for hg user where it belongs
Paul Crowley <paul@lshift.net>
parents: 79
diff changeset
    26
refreshauth.refreshAuth(pentry.pw_dir)