Rebuild repo only for non-empty dirs (once)
authorJakub Skoczen <jakub@indexdata.dk>
Mon, 12 Jul 2010 14:00:15 +0000 (16:00 +0200)
committerJakub Skoczen <jakub@indexdata.dk>
Mon, 12 Jul 2010 14:00:15 +0000 (16:00 +0200)
update-archive/update-yum-archve.sh

index 54b208a..9d49d26 100755 (executable)
@@ -48,6 +48,7 @@ for vdist in centos/5.5 rhel/5.5; do
       fi
     done
     for arch in $architectures; do
+      dirs_to_upd="${dirs_to_upd} ${ftpdir}/${d}/${arch}"
       for l in $d/$arch/Packages/*; do
         if test -L "$l"; then
           if test ! -f "$l"; then
@@ -85,7 +86,6 @@ for vdist in centos/5.5 rhel/5.5; do
                 has_packages=true
               fi
             done
-            dirs_to_upd="${dirs_to_upd} ${ftpdir}/${d}/${arch}"
           done
         fi
       fi
@@ -97,17 +97,20 @@ rpm --addsign ${pkgs_to_sign}
 chgrp staff ${pkgs_to_sign}
 chmod g+w ${pkgs_to_sign}
 echo "Updating repository meta:"
-echo ${dirs_to_upd}
 for rdir in ${dirs_to_upd}; do
-  createrepo --update ${rdir}
-  if test -f ${rdir}/repodata/repomd.xml.asc; then
-    rm ${rdir}/repodata/repomd.xml.asc
+  echo "Section ${rdir}"
+  if test -d $rdir && ls -A $rdir; then
+       createrepo --update ${rdir}
+       if test -f ${rdir}/repodata/repomd.xml.asc; then
+               rm ${rdir}/repodata/repomd.xml.asc
+       fi
+       gpg --detach-sign -u "Index Data" --armor ${rdir}/repodata/repomd.xml
+  else
+       echo "Empty."
   fi
-  gpg --detach-sign -u "Index Data" --armor ${rdir}/repodata/repomd.xml
 done
 # Local Variables:
 # mode:shell-script
 # sh-indentation: 2
 # sh-basic-offset: 8
 # End:
-