]> oss.titaniummirror.com Git - repo_shell.git/blobdiff - scripts/gitcreate
Add scripts/gitcreate, mv svncreate to scripts/
[repo_shell.git] / scripts / gitcreate
diff --git a/scripts/gitcreate b/scripts/gitcreate
new file mode 100755 (executable)
index 0000000..2c65515
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# gitcreate is part of the repo_shell distribution.
+
+source /etc/repo_shell.cfg
+if [ -z "$owner" -o -z "$git_root" -o -z "$git_acl_file" ]; then
+    echo "$0: please configure /etc/repo_shell.cfg"
+fi
+
+if [ "$(whoami)" != "$owner" ]; then
+    echo "$0: must run as user $owner" >&2
+    exit 1
+fi
+
+if [ $# -ne 1 ]; then
+    echo "usage: $0 <repopath>" >&2
+    exit 1
+fi
+
+if [ -e $git_root/$1 ]; then
+    echo "$0: repository $1 already exists" >&2
+    exit 1
+fi
+
+# Create the respository
+umask 027
+git --git-dir "$git_root/$1.git" init --bare
+[ $? -ne 0 ] && exit 1
+
+echo "Repository created.
+Be sure to edit $git_acl_file to allow user access, if needed."
+exit 0