PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of FEATURE variable in ${conf_file_to_test}, define the variable FEATURE only once in ${conf_file_to_test} ;"
echo -e "${RED}Multiple definitions of FEATURE variable in ${conf_file_to_test} : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Portage PORTAGE_BINHOST not configured, add PORTAGE_BINHOST=\"${BINPKGREPO}\" in ${conf_file_to_test} ;"
echo -e "${RED}Portage PORTAGE_BINHOST is NOT well CONFIGURED in ${conf_file_to_test} : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of PORTAGE_BINHOST variable in ${conf_file_to_test}, define the variable PORTAGE_BINHOST only once in ${conf_file_to_test} ;"
echo -e "${RED}Multiple definitions of PORTAGE_BINHOST variable in ${conf_file_to_test} : check KO${NC}\n"
# Else it's OK
else
echo -e "${GREEN}Portage PORTAGE_BINHOST variable well CONFIGURED in ${conf_file_to_test} : check OK${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of ACCEPT_LICENSE variable in ${conf_file_to_test}, define the variable ACCEPT_LICENSE only once in ${conf_file_to_test} ;"
echo -e "${RED}Multiple definitions of ACCEPT_LICENSE variable in ${conf_file_to_test} : check KO${NC}\n"
# Else it's OK
else
echo -e "${GREEN}Portage ACCEPT_LICENSE variable well CONFIGURED in ${conf_file_to_test} : check OK${NC}\n"
PORTAGE_USE_SORTED="$(echo${PORTAGE_USE}| sed 's/ /\n/g'| sort | tr '\n'' '| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
# Global USE flags in ${conf_file_to_test} is well configured
if["$ACTUAL_PORTAGE_USE"=="$PORTAGE_USE_SORTED"]
then
echo -e "${GREEN}Global USE flags in ${conf_file_to_test} is well configured : check OK${NC}\n"
# Global USE flags in ${conf_file_to_test} is NOT well configured
else
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global USE flags in ${conf_file_to_test} is NOT well CONFIGURED, set USE=\"${PORTAGE_USE_SORTED}\" in ${conf_file_to_test} ;"
echo -e "${RED}Global USE flags in ${conf_file_to_test} is NOT well CONFIGURED : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global USE flags in ${conf_file_to_test} has multiple definitions OR there is NO USE variable, define USE variable and only once in ${conf_file_to_test} ;"
echo -e "${RED}Global USE flags in ${conf_file_to_test} has multiple definitions OR USE variable is not defined : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of CHOST variable in ${conf_file_to_test}, define the variable CHOST only once in ${conf_file_to_test} ;"
echo -e "${RED}Multiple definitions of CHOST variable in ${conf_file_to_test} : check KO${NC}\n"
# Else it's OK
else
echo -e "${GREEN}Portage CHOST variable well CONFIGURED in ${conf_file_to_test} : check OK${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Portage CHOST not configured, add GRUB_PLATFORMS=\"${PORTAGE_GRUB_PLATFORMS}\" in ${conf_file_to_test} ;"
echo -e "${RED}Portage GRUB_PLATFORMS feature is NOT well CONFIGURED in ${conf_file_to_test} : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of GRUB_PLATFORMS variable in ${conf_file_to_test}, define the variable GRUB_PLATFORMS only once in ${conf_file_to_test} ;"
echo -e "${RED}Multiple definitions of GRUB_PLATFORMS variable in ${conf_file_to_test} : check KO${NC}\n"
# Else it's OK
else
echo -e "${GREEN}Portage GRUB_PLATFORMS variable well CONFIGURED in ${conf_file_to_test} : check OK${NC}\n"
# Check if GENTOO_MIRRORS value in ${conf_file_to_test} includes organization mirror
sed -n '/^[[:space:]]*GENTOO_MIRRORS=\"/,/\"/p'${conf_file_to_test}| grep -q "${PORTAGE_ORGANIZATION_MIRROR}"
# Return Code
RC=$?
# GENTOO_MIRRORS in ${conf_file_to_test} includes organization mirror
if[$RC -eq 0]
then
echo -e "${GREEN}GENTOO_MIRRORS in ${conf_file_to_test} includes organization mirror : check OK${NC}\n"
# GENTOO_MIRRORS in ${conf_file_to_test} does NOT includes organization mirror
else
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} GENTOO_MIRRORS in ${conf_file_to_test} does NOT includes organization mirror, add ${PORTAGE_ORGANIZATION_MIRROR} mirror in GENTOO_MIRRORS variable in ${conf_file_to_test} ;"
echo -e "${RED}GENTOO_MIRRORS in ${conf_file_to_test} does NOT includes organization mirror : check KO${NC}\n"
fi
else
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} GENTOO_MIRRORS in ${conf_file_to_test} has multiple definitions OR there is NO GENTOO_MIRRORS variable, define GENTOO_MIRRORS variable and only once in ${conf_file_to_test} ;"
echo -e "${RED}GENTOO_MIRRORS in ${conf_file_to_test} has multiple definitions OR GENTOO_MIRRORS variable is not defined : check KO${NC}\n"
echo -e "${GREEN}Global CPU_FLAGS_X86 flags in ${conf_file_to_test} is well configured : check OK${NC}\n"
# Global CPU_FLAGS_X86 flags in ${conf_file_to_test} is NOT well configured
else
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global CPU_FLAGS_X86 flags in ${conf_file_to_test} is NOT well CONFIGURED, set CPU_FLAGS_X86=\"${PORTAGE_CPU_FLAGS_X86_SORTED}\" in ${conf_file_to_test} ;"
echo -e "${RED}Global CPU_FLAGS_X86 flags in ${conf_file_to_test} is NOT well CONFIGURED : check KO${NC}\n"
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global CPU_FLAGS_X86 flags in ${conf_file_to_test} has multiple definitions OR there is NO CPU_FLAGS_X86 variable, define CPU_FLAGS_X86 variable and only once in ${conf_file_to_test} ;"
echo -e "${RED}Global CPU_FLAGS_X86 flags in ${conf_file_to_test} has multiple definitions OR CPU_FLAGS_X86 variable is not defined : check KO${NC}\n"