set uploadpack to true as well
[infrastructure.git] / scripts / git-check.sh
index 67b2a42..5b30f8f 100755 (executable)
@@ -14,8 +14,10 @@ function missing_gitweb () {
     echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx missing in gitweb (for web)"
     for i in $gitwebfiles; do
        echo -n "$i "
-       if [ ! -f ${i} ] ; then
-           echo "WARNING: IS MISSING.. " ; 
+       if [ -f ${i} ] ; then
+           echo -n "OK "
+       else
+           echo -n "MISSING.. " ; 
        fi
     done
     echo ""
@@ -27,9 +29,9 @@ function fill_descriptions () {
     for arg in "$@" ; do
        # accept args like plcapi or plcapi.git
        b=$(basename $arg .git)
-       giti=${b}.git
+       git=${b}.git
        echo -n "$git "
-       grep Unnamed $git/description && { echo -n $i "Setting.. "; echo $b > $git/description ; }
+       grep -q Unnamed $git/description && { echo -n $i "Setting.. "; echo $b > $git/description ; }
     done
     echo ""
 }
@@ -39,13 +41,13 @@ function upload_archives () {
     for arg in "$@" ; do
        # accept args like plcapi or plcapi.git
        b=$(basename $arg .git)
-       giti=${b}.git
+       git=${b}.git
        echo -n "$git "
-       if ! grep uploadarch $git/config ; then
+       if ! grep -q uploadarch $git/config ; then
            echo -n $i "Setting.. "; 
            cat >> $git/config <<EOF
 [daemon]
-       uploadpack = false
+       uploadpack = true
        uploadarch = true
 EOF
        fi
@@ -53,6 +55,22 @@ EOF
     echo ""
 }
 
-missing_gitweb
-fill_descriptions $(ls *.git)
-upload_archives $(ls *.git)
+function check_permissions () {
+    echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx checking descriptions "
+    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
+       chmod -R g+w,o-w $git
+    done
+    echo ""
+}
+
+# missing_gitweb
+args="$@"
+[[ -z "$args" ]] && args=$(ls -d *.git)
+fill_descriptions $args
+upload_archives $args
+check_permissions $args