install
branchdebian
changeset 172 5dd3698fad54
parent 118 107906bfe2c6
parent 171 7b69d1d86254
child 174 f141a4b9d5a9
--- a/install	Tue Oct 13 18:32:26 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import shutil
-import os
-import pwd
-import subprocess
-import optparse
-
-oparser = optparse.OptionParser()
-
-oparser.add_option("--prefix")
-oparser.add_option("--root")
-oparser.set_defaults(root="", prefix="/usr/local")
-(options, args) = oparser.parse_args()
-
-if len(args) > 0:
-    oparser.print_help()
-    sys.exit(-1)
-
-# This must be run as root, because it must create an hg user.
-# Normally the clean thing to do is let it fail with a permission error
-# if a non-root user tries to run it, but I don't want anyone thinking
-# that they can make it work as non-root by changing install paths.
-# Patches for doing this more cleanly welcome of course.
-
-if os.getgid() != 0:
-    print >>sys.stderr, "Install must be run as root user"
-    sys.exit(-1)
-
-
-def installFiles(d, *sources):
-    d = options.root + d
-    os.makedirs(d)
-    for f in sources:
-        shutil.copy(f, d)
-
-installFiles(options.prefix + '/share/mercurial-server',
-    'src/hg-ssh',
-    'src/refresh-auth')
-installFiles(options.prefix + '/share/mercurial-server/mercurialserver',
-    'src/mercurialserver/__init__.py',
-    'src/mercurialserver/paths.py',
-    'src/mercurialserver/changes.py',
-    'src/mercurialserver/access.py',
-    'src/mercurialserver/servelog.py',
-    'src/mercurialserver/refreshauth.py',
-    'src/mercurialserver/ruleset.py')
-installFiles(options.prefix + '/share/mercurial-server/init',
-    'src/init/hginit',
-    'src/init/hgadmin-hgrc')
-installFiles(options.prefix + '/share/doc/mercurial-server',
-    'README',
-    'doc/configuring-access',
-    'doc/file-conditions',
-    'doc/how-it-works',
-    'doc/security')
-installFiles('/etc/mercurial-server',
-    'src/init/conf/remote-hgrc',
-    'src/init/conf/access.conf')
-installFiles('/etc/mercurial-server/keys/root')
-installFiles('/etc/mercurial-server/keys/users')
-
-def becomeFunc(u):
-    p = pwd.getpwnam(u)
-    def become():
-        os.setgid(p.pw_gid)
-        os.setegid(p.pw_gid)
-        os.setuid(p.pw_uid)
-        os.seteuid(p.pw_uid)
-    return become
-
-if options.root == '':
-    try:
-       pwd.getpwnam('hg')
-    except KeyError:
-        subprocess.check_call(
-            "adduser --system --shell /bin/sh --group --disabled-password".split() + 
-            ["--gecos", "Mercurial repositories", "hg"])
-        subprocess.check_call([options.prefix + '/share/mercurial-server/init/hginit',
-            options.prefix + '/share/mercurial-server'],
-            preexec_fn = becomeFunc('hg'))
-