src/refresh-auth
branchdebian
changeset 172 5dd3698fad54
parent 165 3606d60b07e5
child 211 0cd59649772c
equal deleted inserted replaced
118:107906bfe2c6 172:5dd3698fad54
     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
    10 import os
    11 import pwd
       
    12 from mercurialserver import refreshauth, paths
    11 from mercurialserver import refreshauth, paths
    13 
    12 
    14 if len(sys.argv) != 1:
    13 if len(sys.argv) != 1:
    15     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    14     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    16     sys.exit(-1)
    15     sys.exit(-1)
    17 
    16 
    18 pentry = pwd.getpwuid(os.geteuid())
    17 # To protect the authorized_keys file for innocent users, you have to have
    19 if pentry.pw_name != "hg":
    18 # a ~/.mercurial-server file to run this.
    20     # FIXME: re-execute
    19 if not paths.configExists():
    21     print >>sys.stderr, "Must be run as the 'hg' user"
    20     print >>sys.stderr, "Must be run as the 'hg' user"
    22     sys.exit(-1)
    21     sys.exit(-1)
    23 
    22 
    24 paths.setExePath()
    23 paths.setExePath()
    25 
    24 refreshauth.refreshAuth()
    26 refreshauth.refreshAuth(pentry.pw_dir)