diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-05-29 18:31:33 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-05-29 18:31:33 +0200 |
commit | 3f4250926be3ceefd9792c5a78c89d136b02d2cf (patch) | |
tree | 793fb3900da0b14b0012a537576ff05c2d2fecb0 /server | |
parent | 75cb85e0cfa66480492b80ada19bd5a02ea12305 (diff) |
Add server-side mkrepo script
Diffstat (limited to 'server')
-rwxr-xr-x | server/mkrepo.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/server/mkrepo.sh b/server/mkrepo.sh new file mode 100755 index 0000000..9c40529 --- /dev/null +++ b/server/mkrepo.sh @@ -0,0 +1,59 @@ +#! /usr/bin/env bash + +# Create remote git repository (on the server). You must run this script +# from the directory where you want the repository to be created. +# +# Usage: mkrepo.sh [<options>] <name> +# +# --private make the repository private +# +# Note: <name> if without the .git suffix. +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +public=y + +while [ $# -gt 0 ]; do + case $1 in + --private) + public=n + shift + ;; + -*) + error "unknown option: $1" + exit 1 + ;; + *) + break + ;; + esac +done + +if [ "$1" = "" ]; then + error "repository name expected" + exit 1 +fi + +r=$1.git + +mkdir $r +chgrp scm $r +git --bare init --shared=all $r +error "Enter project description (one line; or edit $r/descrition later)" +error "Hit Ctrl-D when done" +cat >$r/description +chgrp -R scm $r + +if [ "$public" = "y" ]; then + f=$r/git-daemon-export-ok + touch $f + chgrp scm $f + chmod g+w $f +fi + +mv $r/hooks/post-update.sample $r/hooks/post-update |