# !/bin/bash printf "\033c" DIR=`pwd` red=$'\e[1;31m' grn=$'\e[1;32m' yel=$'\e[1;33m' blu=$'\e[1;34m' mag=$'\e[1;35m' cyn=$'\e[1;36m' end=$'\e[0m' format="| MD5 | %-32s | Name | %-80s\n" echo -n " Preparing IT4I .......... [" for a in `find /apps/easybuild/easyconfigs-develop/easybuild/easyconfigs/ -type f -name *.eb`; do md5sum $a | grep -v "__archive__" | sed 's| .||' | cut -d '/' -f 1,8 | tr "/" ";" | sed 's|apps||'; done > develop && echo -e "\e[32m OK \e[0m]" || echo -e "\e[31mFAIL\e[0m]" echo -n " Preparing develop ....... [" for a in `find . -type f -name *.eb`; do md5sum $a | grep -v "__archive__" | sed 's| .||' | cut -d '/' -f 1,4 | tr "/" ";" | sed 's|apps||'; done > it4i && echo -e "\e[32m OK \e[0m]" || echo -e "\e[31mFAIL\e[0m]" echo "" echo "Checking..." for x in `cat develop`; do X=$(echo $x | cut -d ';' -f 1) Xname=$(echo $x | cut -d ';' -f 2) for y in `cat it4i | cut -d ';' -f 1`; do if [ "$X" = "$y" ]; then printf "$format" "${red}$X${end}" "${red}$Xname${end}" echo "$x" >> duplicate break fi done printf "$format" "${grn}$X${end}" "${grn}$Xname${end}" done echo "" for read in `cat duplicate`; do grep "$read" it4i; done | sort -u > remove_list for rm in `cat remove_list | cut -d ';' -f 2`; do find . -name $rm -exec rm {} \;; done rm it4i develop duplicate remove_list