mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

initgit (662B)


      1 #!/bin/bash
      2 
      3 NAME="$1"
      4 shift
      5 DESC="$@"
      6 
      7 HOSTNAME=$(hostname | cut -d. -f1)
      8 if [[ $HOSTNAME != "ulminfo" ]]
      9 then
     10   exec ssh ulminfo bin/initgit "$NAME" \"$DESC\"
     11 fi
     12 
     13 if [ -d "$HOME/git/${NAME}.git" ]
     14 then
     15   echo "repository $NAME already exists?! aborting"
     16   exit 42
     17 fi
     18 
     19 cd "$HOME/git"
     20 git init --bare "${NAME}.git"
     21 cd "${NAME}.git"
     22 echo "$DESC" > description
     23 echo "https://a3nm.net/git/$NAME/" > url
     24 git update-server-info
     25 
     26 cd hooks
     27 mv post-update.sample post-update
     28 ln -s "$HOME/bin/stagit-post-receive.sh" post-receive
     29 cd ..
     30 
     31 mkdir "$HOME/public_html/git/${NAME}"
     32 ln -s "$HOME/git/${NAME}.git" "$HOME/public_html/git/"
     33 
     34 chmod -R og+rx "$HOME/git/${NAME}.git"
     35