stagit-newrepo (850B)
1 #!/bin/sh 2 3 set -eu 4 5 . /var/git/config.rc 6 7 e_log() { 8 printf '%s\n' "$*" 9 } 10 11 e_err() { 12 printf '%s\n' "$*" >&2 13 } 14 15 e_exit() { 16 e_err "$*" 17 exit 1 18 } 19 20 DESC="" 21 REPO="" 22 23 if [ $# -gt 1 ]; then 24 DESC="$2" 25 else 26 DESC="$DEFAULT_DESCRIPTION" 27 fi 28 29 if [ $# -eq 0 ]; then 30 e_exit "not enough args" 31 else 32 REPO="$(basename "$1")" 33 fi 34 35 git init --bare "$GIT_HOME/$REPO.git" 36 cp "$GIT_HOME/template/post-receive" "$GIT_HOME/$REPO.git/hooks/post-receive" 37 echo "$CLONE_URI/$REPO.git" > "$GIT_HOME/$REPO.git/url" 38 echo "$DEFAULT_OWNER" > "$GIT_HOME/$REPO.git/owner" 39 if [ -n "$DESC" ]; then 40 echo "$DESC" > "$GIT_HOME/$REPO.git/description" 41 else 42 echo "this is a placeholder" > "$GIT_HOME/$REPO.git/description" 43 fi 44 chmod u+x "$GIT_HOME/$REPO.git/hooks/post-receive" 45 mkdir "$WWW_HOME/$REPO" 46 /usr/local/bin/stagit-gen-index