compare.sh 1.3 KB
Newer Older
Easy Build's avatar
Easy Build committed
1 2 3 4
# !/bin/bash
# skript pro kontrolu zda eb předpis, který je v easyconfigs-it4i je nainstalován

ml --show_hidden -t av 2>&1 > /dev/null| awk '{print $1 }' | grep -v "/apps/*" > ml_av
5
find /apps/easybuild/easyconfigs-it4i/ -type f -name "*.eb" | grep -v "_not_installed/*" | cut -d '/' -f 7 | sed 's/.eb//' | sed 's/-/\//' > eb-it4i
Easy Build's avatar
Easy Build committed
6 7 8

printf "\033c"
echo "|easyconfig-it4i|state|" > compare_result.md
Easy Build's avatar
Easy Build committed
9
echo "| --- | --- |" >> compare_result.md
Easy Build's avatar
Easy Build committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

INSTALL="FALSE"
format="%-80s %30s\n"

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'

while read x; do 
   while read y; do 
      if [ "$x" = "$y" ]; then 
         INSTALL="OK"
         break
      fi
   done < <(cat ml_av) 

   if [ ! "$INSTALL" = "OK" ]; then
      if [ -d "/apps/all/$x" ]; then
         INSTALL="WARNING"
      fi
   fi  

   if [ "$INSTALL" = "OK" ]; then
      printf "$format" "$x" "${grn}installed${end}"
      INSTALL="FALSE"
   elif [ "$INSTALL" = "WARNING" ]; then
      printf "$format" "$x" "${yel}warning${end}"
      echo "|$x|warning|" >> compare_result.md
      INSTALL="FALSE"
   else
      printf "$format" "$x" "${red}not installed${end}"
      echo "|$x|not installed|" >> compare_result.md
46
      echo "$x" >> mv
Easy Build's avatar
Easy Build committed
47 48 49 50 51 52
      INSTALL="FALSE"
   fi

done < <(cat eb-it4i)

rm eb-it4i ml_av