#!/bin/bash
echo "Validate $1"
fixesinstalled=$(</fixesInstalled.txt)
listToInstall=$(</etc/inconcert/chef/data_bags/hotfixer/default.json)
allHotfix=$(<$2)

isntallAll=$(jq '.installAll' /etc/inconcert/chef/data_bags/hotfixer/default.json)


if [[ "$fixesinstalled" == *"$1"* ]];
then
	echo  "$1 installed" >> /fixInstalledChecked.txt
else
	if [[ "$listToInstall" == *"$1"* ]];
	then
		echo  "$1 in list" >> /fixInstalledChecked.txt
	else
     if [[ $isntallAll && "$allHotfix" ==  *"$1"* ]];
     then
         echo  "$1 in list" >> /fixInstalledChecked.txt
     else
		     echo  "$1 pending" >> /fixInstalledChecked.txt
     fi
	fi
fi