diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-04-03 23:44:42 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-04-03 23:44:42 +0200 |
commit | cd27080271b03eb81ade08b2346285c2152bd0f7 (patch) | |
tree | dea85d97bdb1a00cb9027b980291b3feaa04c1c7 /bin/new-repo | |
parent | ffd6224de2eed7c540fcf051bc4822382d19f5b6 (diff) |
Remove stagit code
Diffstat (limited to 'bin/new-repo')
-rwxr-xr-x | bin/new-repo | 22 |
1 files changed, 22 insertions, 0 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/" |