scripts

random scripts
git clone https://git.parazyd.org/scripts
Log | Files | Refs

addrepo.sh (758B)


      1 #!/bin/sh
      2 #
      3 # parazyd - (c) wtfpl 2016
      4 # add a repository to gitolite conf and push
      5 
      6 GITOLITE="/home/parazyd/devel/parazyd.cf-gitolite"
      7 GITSERVER="git.parazyd.cf"
      8 
      9 reponame="$1"
     10 repodesc="$2"
     11 repoowner=`awk '/name =/ {print $3}' ~/.gitconfig`
     12 [ -n "$3" ] && repoowner="$3"
     13 
     14 
     15 writeconf() {
     16 	if [ $repodesc = private ]; then
     17 	cat <<EOF
     18 repo $reponame
     19 	RW		=	$repoowner
     20 
     21 EOF
     22 	else
     23 	cat <<EOF
     24 repo $reponame
     25 	RW+		=	$repoowner
     26 	R		=	gitweb daemon
     27 
     28 EOF
     29 	fi
     30 }
     31 
     32 if [ -n $reponame ]; then
     33 	cd $GITOLITE
     34 	writeconf >> conf/gitolite.conf
     35 	git commit conf/gitolite.conf -m "added $reponame repository"
     36 	git push
     37 	cd -
     38 else
     39 	echo "usage: `basename $0` [repo name] [repo description] [repo owner]"
     40 fi
     41 
     42 
     43 ssh $GITSERVER ~/bin/gitadd.sh "$reponame" "$repodesc" "$repoowner"