src.hhvn.uk > hhvn.uk-scripts > file > repo > mkrepo

scripts that power hhvn.uk
Log | Files | Refs | README

mkrepo (401B)


      1 #!/bin/rc
      2 
      3 user   = _git
      4 domain = `hostname
      5 gitdir = /var/git
      6 
      7 fn as {
      8 	doas -u $user $*
      9 }
     10 
     11 estatus = 0
     12 
     13 for (repo in $*) {
     14 	rdir = $gitdir/$repo
     15 
     16 	if (!test -e $rdir) {
     17 		as mkdir $rdir
     18 		cd $rdir
     19 		as git init --bare
     20 
     21 		echo
     22 		echo git remote add origin $domain:$rdir
     23 		echo git push --set-upstream origin master
     24 	} else {
     25 		estatus = 1
     26 		echo error: $rdir already exists >[1=2]
     27 	}
     28 }
     29 
     30 exit $estatus