duplicate.sh 1.33 KB
Newer Older
1 2
# !/bin/bash

Easy Build's avatar
Easy Build committed
3 4
printf "\033c"
DIR=`pwd`
5

6 7 8 9 10 11 12 13 14
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" 
15

Easy Build's avatar
Easy Build committed
16 17 18 19 20 21
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]"

22
echo ""
Lukáš Krupčík's avatar
Lukáš Krupčík committed
23
echo "Checking..."
24

Easy Build's avatar
Easy Build committed
25 26 27 28 29 30
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}"
31 32 33
         echo "$x" >> duplicate
         break
      fi
Easy Build's avatar
Easy Build committed
34
   done
35
   printf "$format" "${grn}$X${end}" "${grn}$Xname${end}"
Easy Build's avatar
Easy Build committed
36
done
37 38 39

echo ""

Lukáš Krupčík's avatar
Lukáš Krupčík committed
40 41 42 43
#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 
Lukáš Krupčík's avatar
Lukáš Krupčík committed
44