X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fgit-check.sh;h=ef395ed3d907c5073b8837f8ae9b65ed4dedf5b7;hb=ac2aad55e3fe013533a4d8168d6585f724f62768;hp=43f2c5d8c1e8ab6fcb7ec4da3d8e4b6d22aacf2c;hpb=6c42aebf2e52992eae70970ad7d4dea02f7c2623;p=infrastructure.git diff --git a/scripts/git-check.sh b/scripts/git-check.sh index 43f2c5d..ef395ed 100755 --- a/scripts/git-check.sh +++ b/scripts/git-check.sh @@ -1,5 +1,7 @@ #!/bin/sh +MLIST="git@onelab.eu" + cd /git gitwebfiles="git-favicon.png git-logo.png gitweb.cgi gitweb.css" @@ -37,14 +39,30 @@ function fill_descriptions () { echo "" } +function update_server_info () { + echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx updating server info " + for arg in "$@" ; do + # accept args like plcapi or plcapi.git + b=$(basename $arg .git) + git=${b}.git + echo -n "$git " + cd $git + git update-server-info + cd - >& /dev/null + done + echo "" +} + function check_permissions () { echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx checking permissions " for arg in "$@" ; do # accept args like plcapi or plcapi.git b=$(basename $arg .git) git=${b}.git - echo -n "$git " - chown -R root:onelab $git + owner=root:onelab + if [ -f $git/owner ] ; then owner=$(cat $git/owner); fi + echo -n "$git ($owner) " + chown -R $owner $git chmod -R g+w,o-w $git done echo "" @@ -58,12 +76,14 @@ function check_configs () { git=${b}.git echo -n "$git " cd $git + git config core.bare true; echo -n "bare "; + git config core.sharedrepository >& /dev/null || { git config core.sharedrepository true; echo -n "sharedrepository "; } git config daemon.uploadpack >& /dev/null || { git config daemon.uploadpack true; echo -n "uploadpack "; } git config daemon.uploadarch >& /dev/null || { git config daemon.uploadarch true; echo -n "uploadarch "; } - git config hooks.mailinglist >& /dev/null || { git config hooks.mailinglist build@onelab.eu; echo -n "mailinglist "; } - git config hooks.announcelist >& /dev/null || { git config hooks.announcelist build@onelab.eu; echo -n "announcelist "; } - git config hooks.envelopesender >& /dev/null || { git config hooks.envelopesender build@onelab.eu; echo -n "envelopesender "; } - git config hooks.emailprefix >& /dev/null|| { git config hooks.emailprefix '[GIT]'; echo -n "emailprefix "; } + (git config hooks.mailinglist|grep $MLIST) >& /dev/null || { git config hooks.mailinglist $MLIST; echo -n "mailinglist "; } + (git config hooks.announcelist|grep $MLIST) >& /dev/null || { git config hooks.announcelist $MLIST; echo -n "announcelist "; } + (git config hooks.envelopesender|grep $MLIST) >& /dev/null || { git config hooks.envelopesender $MLIST; echo -n "envelopesender "; } + git config hooks.emailprefix >& /dev/null || { git config hooks.emailprefix ''; echo -n "emailprefix "; } cd - >& /dev/null done echo "" @@ -76,7 +96,8 @@ function check_hooks () { b=$(basename $arg .git) git=${b}.git echo -n "$git " - (cd $git/hooks; [ -h post-receive ] || ln -sf /usr/share/doc/git-1.5.5.6/hooks/post-receive-email post-receive ) + # standard version is in /usr/share/doc/git-1.5.5.6/hooks/post-receive-email + (cd $git/hooks; cp -f /root/bin/post-receive-email-with-diffs post-receive; chmod 755 post-receive ) done echo "" } @@ -85,6 +106,7 @@ function check_hooks () { args="$@" [[ -z "$args" ]] && args=$(ls -d *.git) fill_descriptions $args +update_server_info $args check_permissions $args check_configs $args check_hooks $args