summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McGrath <mmcgrath@laptop.mmcgrath.net>2008-01-03 18:46:37 (GMT)
committerMike McGrath <mmcgrath@laptop.mmcgrath.net>2008-01-03 18:46:37 (GMT)
commit24c60d483ac1f189b64bc6b9352058937649b4ee (patch)
tree5c646e030c18474f0ae9f47f65777770cf55b2a9
parentd60c65ede027a3c12fcbc7d512842ab1d1ee28ca (diff)
downloadfedora-infrastructure-24c60d483ac1f189b64bc6b9352058937649b4ee.zip
fedora-infrastructure-24c60d483ac1f189b64bc6b9352058937649b4ee.tar.gz
fedora-infrastructure-24c60d483ac1f189b64bc6b9352058937649b4ee.tar.xz
Added run-scm for fedora-hosted stuff
-rwxr-xr-xscripts/run-scm/run-bzr5
-rwxr-xr-xscripts/run-scm/run-git54
-rwxr-xr-xscripts/run-scm/run-hg5
-rwxr-xr-xscripts/run-scm/run-svnserve4
4 files changed, 68 insertions, 0 deletions
diff --git a/scripts/run-scm/run-bzr b/scripts/run-scm/run-bzr
new file mode 100755
index 0000000..1c89976
--- /dev/null
+++ b/scripts/run-scm/run-bzr
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+umask 0002
+exec /usr/bin/bzr "$@"
+
diff --git a/scripts/run-scm/run-git b/scripts/run-scm/run-git
new file mode 100755
index 0000000..7d7e4ce
--- /dev/null
+++ b/scripts/run-scm/run-git
@@ -0,0 +1,54 @@
+#!/usr/bin/python -tt
+
+import sys, os
+
+commands = {
+ "git-receive-pack": "/usr/bin/git-receive-pack",
+ "git-upload-pack": "/usr/bin/git-upload-pack",
+ "bzr": "/usr/bin/run-bzr",
+ "hg": "/usr/bin/run-hg",
+ "svnserve": "/usr/bin/run-svnserve",
+ "scp": "/usr/bin/scp",
+}
+
+if __name__ == '__main__':
+ orig_cmd = os.environ.get('SSH_ORIGINAL_COMMAND')
+ if not orig_cmd:
+ print "Need a command"
+ sys.exit(1)
+ allargs = orig_cmd.split()
+ try:
+ basecmd = os.path.basename(allargs[0])
+ cmd = commands[basecmd]
+ except:
+ sys.stderr.write("Invalid command %s\n" % orig_cmd)
+ sys.exit(2)
+
+ if basecmd in ('git-receive-pack', 'git-upload-pack'):
+ # git repositories need to be parsed specially
+ thearg = ' '.join(allargs[1:])
+ if thearg[0] == "'" and thearg[-1] == "'":
+ thearg = thearg.replace("'","")
+ thearg = thearg.replace("\\'", "")
+ if thearg[:len('/git/')] != '/git/' or not os.path.isdir(thearg):
+ print "Invalid repository %s" % thearg
+ sys.exit(3)
+ allargs = [thearg]
+ elif basecmd in ('scp'):
+ thearg = ' '.join(allargs[1:])
+ if thearg.find('/') != -1:
+ print "scp yourfile-1.2.tar.gz scm.fedorahosted.org:$YOURPROJECT # No trailing /"
+ sys.exit(4)
+ else:
+ newargs = []
+ newargs.append(allargs[0])
+ newargs.append(allargs[1])
+ newargs.append("/srv/web/releases/%s/" % allargs[2])
+ os.execv(cmd, [cmd] + newargs[1:])
+ sys.exit(1)
+ else:
+ allargs = allargs[1:]
+ os.execv(cmd, [cmd] + allargs)
+ sys.exit(1)
+
+
diff --git a/scripts/run-scm/run-hg b/scripts/run-scm/run-hg
new file mode 100755
index 0000000..0c5c6f1
--- /dev/null
+++ b/scripts/run-scm/run-hg
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+umask 0002
+exec /usr/bin/hg "$@"
+
diff --git a/scripts/run-scm/run-svnserve b/scripts/run-scm/run-svnserve
new file mode 100755
index 0000000..e4f5b27
--- /dev/null
+++ b/scripts/run-scm/run-svnserve
@@ -0,0 +1,4 @@
+#!/bin/bash
+umask 0002
+exec /usr/bin/svnserve -t
+