stagit

- static git page generator
git clone git://git.acid.vegas/stagit.git
Log | Files | Refs | Archive | README | LICENSE

repo (1225B)

      1 #!/bin/sh
      2 # git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
      3 
      4 if [ "$#" -ne 2 ]; then
      5 	echo "invalid arguments (use -c or -d)"
      6 	exit 1
      7 elif [ "$1" = '-c' ]; then
      8 	if [ -d "$2.git" ]; then
      9 		echo "repository already exists"
     10 		exit 1
     11 	else if [ ! -f post-receive ]; then
     12 		echo "missing post-receive script"
     13 		exit 1
     14 	fi
     15 	mkdir "$2.git"
     16 	git init --bare "$2.git"
     17 	touch "$2.git/git-daemon-export-ok"
     18 	ln /srv/git/git-shell-commands/post-receive "$2.git/hooks/post-receive" 
     19 	echo "https://git.acid.vegas/$2.git" > "$2.git/url"
     20 	echo "Description for '$2' repository:"
     21 	read desc
     22 	echo "$desc" > "$2.git/description"
     23 	echo "[~] recreating index..."
     24     args=""
     25     for category in $(cat /srv/git/*/owner | xargs -n1 | sort -u | xargs); do
     26         echo "[~] indexing '$category' repositories..."
     27 		REPOS=$(grep -rl "$category" /srv/git/*/owner | xargs -I{} dirname {} | sort -f | tr '\n' ' ')
     28         args="$args -c \"$category\" $REPOS"
     29     done
     30     echo "$args" | xargs stagit-index > $HTML_DIR/index.html
     31 elif [ "$1" = '-d' ]; then
     32 	if [ ! -d "$2.git" ]; then
     33 		echo "repository does not exist"
     34 		exit 1
     35 	fi
     36 	rm -rf "$2.git"
     37 else
     38 	echo "invalid arguments (use -c or -d)"
     39 	exit 1
     40 fi