diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/new-repo | 22 | ||||
-rwxr-xr-x | bin/stagit-gen-index | 7 | ||||
-rwxr-xr-x | bin/stagit-new-repo | 33 |
3 files changed, 22 insertions, 40 deletions
diff --git a/bin/new-repo b/bin/new-repo new file mode 100755 index 0000000..b68954a --- /dev/null +++ b/bin/new-repo @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script creates a initializes a new git repository and re-indexes all repositories. + +while getopts ":r:d:o:u:h" o; do case "$o" in + h) printf "Argument for creating a new git repository:\\n -r: Repository name\\n -d: Short description of the project\\n -o: Name of the owner\\n -h: Show this message\\n" && exit 1 ;; + r) repo=${OPTARG} || exit 1 ;; + d) desc=${OPTARG} || exit 1 ;; + o) owner=${OPTARG} || exit 1 ;; + *) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;; + esac done + +home="/home/git" +srv="/srv/git" + +[ -d "$srv/$repo.git" ] && echo "$repo already exists!" && exit 1 + +git init --bare "$srv/$repo.git" +echo "$owner" >"$srv/$repo.git/owner" +echo "$desc" >"$srv/$repo.git/description" +chown -R git:git "$srv/$repo.git" +ln -s "$srv/$repo.git" "$home/" diff --git a/bin/stagit-gen-index b/bin/stagit-gen-index deleted file mode 100755 index a6bc0b0..0000000 --- a/bin/stagit-gen-index +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Index repositories. - -srv="/srv/git" -www="/var/www/git" -stagit-index "$srv"/*.git > "$www"/index.html diff --git a/bin/stagit-new-repo b/bin/stagit-new-repo deleted file mode 100755 index 15e50e8..0000000 --- a/bin/stagit-new-repo +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# This script creates a initializes a new git repository and re-indexes all repositories. - -while getopts ":r:d:o:u:h" o; do case "${o}" in - h) printf "Arguement for creating a new git repository:\\n -r: Repository name\\n -d: Short description of the project\\n -o: Name of the owner\\n -u: URI for cloning\\n -h: Show this message\\n" && exit 1 ;; - r) repo=${OPTARG} || exit 1 ;; - d) desc=${OPTARG} || exit 1 ;; - o) owner=${OPTARG} || exit 1 ;; - u) uri=${OPTARG} || exit 1 ;; - *) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;; -esac done - -home="/home/git" -srv="/srv/git" -www="/var/www/git" - -[ -d "$srv/$repo.git" ] && echo "$repo already exists!" && exit 1 - -git init --bare "$srv/$repo.git" -cp "/usr/local/share/post-receive" "$srv/$repo.git/hooks/post-receive" -chmod u+x "$srv/$repo.git/hooks/post-receive" -echo "git@$uri:$repo.git" > "$srv/$repo.git/url" -echo "$owner" > "$srv/$repo.git/owner" -echo "$desc" > "$srv/$repo.git/description" -chown -R git:git "$srv/$repo.git" -ln -svf "$srv/$repo.git" "$home/" - -[ -d "$www/$repo" ] && echo "$www/$repo already exists!" && exit 1 -mkdir "$www/$repo" -chown -R git:git "$www/$repo" - -stagit-gen-index |