#!/bin/sh 

# format,
#   runall clean
#   runall README
#   runall rr

progname=$(basename $0)

if [ $# -eq 0 ]; then
    echo "Usage: $progname (clean|setup|run)" >&2;
    exit 1
fi

for i in `ls -1 `; do
   if ( file $i | grep -F directory | grep -Fq typed ); then
       cd $i;
       if [ "$1" = "clean" ]; then
           printf "\n ==> CLEANING on %s\n" "$i" >& 2 ;
           rm -rf *.der *.pem creds_dump
       elif [ "$1" = "setup" ]; then
           printf "\n ==> SETUP on %s\n" "$i"  >& 2;
           README
       elif [ "$1" = "run" ] ; then
           printf "\n ==> RUN on %s\n" "$i" ;
           rr
       fi 
       cd ..;
   fi
done
