stagit- static git page generator |
git clone git://git.acid.vegas/stagit.git |
Log | Files | Refs | Archive | README | LICENSE |
post-receive (821B)
1 #!/bin/sh 2 # stagit post-receive script - developed by acidevegas (https://git.acid.vegas/stagit) 3 4 URL="git.acid.vegas" 5 PROTO="https" 6 CLONE_URL="git://$URL" 7 COMMIT_LIMIT=100 8 HTML_DIR="/srv/http" 9 10 DIR="$PWD" 11 REPO=$(basename "$DIR" .git) 12 13 command -v stagit >/dev/null 2>&1 || { echo "stagit not found" >&2; exit 1; } 14 15 mkdir -p "$HTML_DIR/$REPO" || { echo "Failed to create directory $HTML_DIR/$REPO" >&2; exit 1; } 16 17 if cd "$HTML_DIR/$REPO"; then 18 stagit -l "$COMMIT_LIMIT" -u "$PROTO://$URL/$REPO" "$DIR" || { echo "stagit failed to generate static pages" >&2; exit 1; } 19 ln -sf log.html index.html 20 git --git-dir="$DIR" archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD || { echo "git archive failed" >&2; exit 1; } 21 else 22 echo "Failed to change directory to $HTML_DIR/$REPO" >&2 23 exit 1 24 fi