#!/bin/bash path=/home/notbuilt built_file=/home/built notbuilt_dir=/home/notmock mkdir -p $notbuilt_dir mkdir -p /tmp/logs cd $path ls -1 [mnopqrstuvwxyz]* | while read VALUE do #is it built already? cat $built_file | grep $VALUE if [ $? -ne 0 ]; then echo "mock $path/$VALUE ..." mock --autocache $path/$VALUE if [ $? -ne 0 ]; then # did not build echo $VALUE >> /tmp/didnotmockbuild cp -f $path/$VALUE $notbuilt_dir #move the logs over cp /var/lib/mock/fedora-development-ia64-core/result/root.log /tmp/logs/$VALUE.root.log else # completed successfully, save space by echoing name in echo $VALUE >> $built_file rm -f /var/lib/mock/fedora-development-ia64-core/result/*debuginfo* mv -f /var/lib/mock/fedora-development-ia64-core/result/*.rpm /home/extras # clean the result directory rm -f /var/lib/mock/fedora-development-ia64-core/result/* createrepo /home/extras yum clean metadata fi fi done