src/refresh-auth
changeset 86 78777f509303
parent 79 3a58a95fae2f
child 165 3606d60b07e5
equal deleted inserted replaced
85:80fa761c7f5d 86:78777f509303
     5 # This script completely destroys your ~/.ssh/authorized_keys
     5 # This script completely destroys your ~/.ssh/authorized_keys
     6 # file every time it is run
     6 # file every time it is run
     7 # WARNING
     7 # WARNING
     8 
     8 
     9 import sys
     9 import sys
       
    10 import os
       
    11 import pwd
    10 from mercurialserver import refreshauth, paths
    12 from mercurialserver import refreshauth, paths
    11 
    13 
    12 if len(sys.argv) != 1:
    14 if len(sys.argv) != 1:
    13     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    15     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    14     sys.exit(-1)
    16     sys.exit(-1)
    15 
    17 
       
    18 pentry = pwd.getpwuid(os.geteuid())
       
    19 if pentry.pw_name != "hg":
       
    20     # FIXME: re-execute
       
    21     print >>sys.stderr, "Must be run as the 'hg' user"
       
    22     sys.exit(-1)
       
    23 
    16 paths.setExePath()
    24 paths.setExePath()
    17 
    25 
    18 refreshauth.refreshAuth()
    26 refreshauth.refreshAuth(pentry.pw_dir)