68 lines
2.6 KiB
Bash
68 lines
2.6 KiB
Bash
echo "-------------------------------------------------"
|
|
echo -e "---------------- ${BLUE}CHECK PACKAGES${NC} -----------------"
|
|
echo -e "-------------------------------------------------\n"
|
|
|
|
# For each package to check
|
|
for package in ${PACKAGES[@]}
|
|
do
|
|
echo -e "Check package : ${BLUE}${package}${NC}"
|
|
|
|
# Check if package is install
|
|
result=$(emerge -pO --quiet ${package})
|
|
|
|
# Return Code
|
|
RC=$?
|
|
|
|
# Strip multiple space
|
|
result=$(echo -e ${result})
|
|
|
|
# If return code different of 0
|
|
if [ $RC -ne 0 ]
|
|
then
|
|
echo -e "${RED}ERROR with ${package} : return code = $RC , please check manually this package (probably USE or KEYWORD to change).${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
echo -e "-----------------------------\n"
|
|
else
|
|
#echo ${result}
|
|
# If package is installed
|
|
if [[ ${result} == *"[ebuild R"*"${package}"* ]]
|
|
then
|
|
echo -e "${GREEN}Package ${package} INSTALLED : check OK${NC}"
|
|
# If package reinstall forced for some reason
|
|
elif [[ ${result} == *"[ebuild r"*"${package}"* ]]
|
|
then
|
|
echo -e "${GREEN}Package ${package} INSTALLED BUT reinstall forced for some reason : check OK${NC}\n"
|
|
# If package need to be installed
|
|
elif [[ ${result} == *"[ebuild N"*"${package}"* ]]
|
|
then
|
|
echo -e "${RED}Package ${package} NOT INSTALLED (New) : check KO${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
# If package updating to another version
|
|
elif [[ ${result} == *"[ebuild U"*"${package}"* ]]
|
|
then
|
|
echo -e "${RED}Package ${package} INSTALLED BUT updating to another version (Updating) : check OK${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
# If package best version seems lower
|
|
elif [[ ${result} == *"[ebuild D"*"${package}"* ]]
|
|
then
|
|
echo -e "${RED}Package ${package} INSTALLED BUT best version seems lower (Downgrading) : check OK${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
# If package blocked
|
|
elif [[ ${result} == *"[ebuild B"*"${package}"* ]]
|
|
then
|
|
echo -e "${RED}Package ${package} NOT INSTALLED (Block) unresolved conflict : check KO${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
# If package blocked but auto resolved conflict
|
|
elif [[ ${result} == *"[ebuild b"*"${package}"* ]]
|
|
then
|
|
echo -e "${RED}Package ${package} NOT INSTALLED (Block) but auto resolved conflict : check KO${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
# Other reason
|
|
else
|
|
echo -e "${RED}Package ${package} NOT INSTALLED (Other reason) : check KO${NC}"
|
|
PACKAGES_TO_CHECK=${PACKAGES_TO_CHECK}" ${package}"
|
|
fi
|
|
echo -e "-------------------------------------------------\n"
|
|
fi
|
|
done
|