]> git.pld-linux.org Git - projects/buildlogs.git/blobdiff - helpers/buildlogs-mover.sh
Silence php notices.
[projects/buildlogs.git] / helpers / buildlogs-mover.sh
index 2e2284d7c92a7c3c7b83ec7e52595abd35edc853..bd917ba41dca47804284c611c7d9acbb03867512 100644 (file)
@@ -9,25 +9,29 @@
 #   .new/
 #   OK/
 #   FAIL/
-#   prevOK/
 #
 # Note that we look for root/*/*/.new/*.info, so don't place any additional
 # directories there.
 
 root="/home/services/ftpd/buildlogs"
+ADDLOG="/home/services/httpd/html/pld-buildlogs/scripts/addlog.php"
 
-#if test -f /etc/buildlogs-mover.conf ; then
-#  . /etc/buildlogs-mover.conf
-#fi
 if test -f /etc/buildlogs-mover.conf ; then
   . /etc/buildlogs-mover.conf
 fi
 
+for n in $root/*/*/.new ; do
+  if test ! -d $n ; then
+    echo "$n doesn't exists or ain't directory"
+    exit 1
+  fi
+  break # don't check all
+done
+
 handle_info () {
   info="$1"
   info_val="$(cat "$info" 2>/dev/null)"
   if echo "$info_val" | grep -q '^END$' ; then
-    rm "$info" 2>/dev/null || return
     status=$(echo "$info_val" | grep '^Status:' | sed -e 's/.*: *//')
     case $status in
       OK ) s=OK ;;
@@ -39,16 +43,17 @@ handle_info () {
        echo "#v+" 1>&2
        echo "$info_val" 1>&2
        echo "#v-" 1>&2
+       rm "$info" 2>/dev/null
        return
         ;;
     esac
     archdir="$(dirname "$(dirname "$info")")"
     file=$(basename "$info" .info)
-    if test -f "$archdir/OK/$file" ; then
-      mv -f "$archdir/OK/$file" "$archdir/prevOK/$file"
+    if test -f "$archdir/.new/$file"; then
+           mv -f "$archdir/.new/$file" "$archdir/$s/$file"
+           $ADDLOG "$archdir/$s/$file"
+           rm "$info" 2>/dev/null
     fi
-    rm -f "$archdir/"{OK,FAIL}"/$file"
-    mv -f "$archdir/.new/$file" "$archdir/$s/$file"
   fi
 }
 
This page took 0.148508 seconds and 4 git commands to generate.