Add portage check : FEATURES, PORTAGE_BINHOST, ACCEPT_LICENSE and USE
This commit is contained in:
parent
e1c9aa250f
commit
f5077121e9
|
@ -56,6 +56,7 @@ export SNMP_CONFIG_CHECK_FAILED=""
|
|||
export POSTFIX_CONFIG_CHECK_FAILED=""
|
||||
export AUTOBACKUP_CONFIG_CHECK_FAILED=""
|
||||
export IPAM_CONFIG_CHECK_FAILED=""
|
||||
export PORTAGE_CONFIG_CHECK_FAILED=""
|
||||
export SERVICES_NOT_STARTED_OR_ERROR=""
|
||||
export BOOL_CHECK_HOSTNAME=0 # Print message at end script if hostname *.grif or *.grifon.fr not configured
|
||||
export BOOL_ADMIN_IPV4_NOT_CONFIGURED=0
|
||||
|
@ -119,20 +120,22 @@ print_config_title 'RECIPE GENTOO - CHECK BASIC CONFIG'
|
|||
|
||||
#. recipes/recipe_check_nrpe_config.sh
|
||||
|
||||
. recipes/recipe_check_munin_config.sh
|
||||
#. recipes/recipe_check_munin_config.sh
|
||||
|
||||
#. recipes/recipe_check_snmp_config.sh
|
||||
|
||||
. recipes/recipe_check_mail_alias_config.sh
|
||||
#. recipes/recipe_check_mail_alias_config.sh
|
||||
|
||||
#. recipes/recipe_check_postfix_protocol_config.sh
|
||||
|
||||
#. recipes/recipe_check_ipam_config.sh
|
||||
|
||||
. recipes/recipe_check_eselect.sh
|
||||
#. recipes/recipe_check_eselect.sh
|
||||
|
||||
. recipes/recipe_check_portage.sh
|
||||
|
||||
. recipes/recipe_final_summary.sh
|
||||
|
||||
. recipes/recipe_addtional_manual_verification.sh
|
||||
#. recipes/recipe_addtional_manual_verification.sh
|
||||
|
||||
exit 0
|
||||
|
|
111
recipes/recipe_check_portage.sh
Normal file
111
recipes/recipe_check_portage.sh
Normal file
|
@ -0,0 +1,111 @@
|
|||
print_config_title 'CHECK PORTAGE CONFIG'
|
||||
|
||||
# Check if make.conf includes FEATURES="getbinpkg"
|
||||
echo "Check if /etc/portage/make.conf includes FEATURES=\"getbinpkg\""
|
||||
grep -q "^[[:space:]]*FEATURES=\"getbinpkg\"[[:space:]]*$" /etc/portage/make.conf
|
||||
|
||||
# Return Code
|
||||
RC=$?
|
||||
|
||||
# Portage conf does NOT include getbinpkg FEATURE
|
||||
if [ $RC -ne 0 ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Portage binpkg feature not configured, add FEATURES=\"getbinpkg\" in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Portage getbinpkg feature NOT CONFIGURED in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Portage conf includes getbinpkg FEATURE
|
||||
else
|
||||
# If there are multiple definitions of FEATURE variable, KO
|
||||
FEATURE_DEFINITION_NUMBER="$(grep "^[[:space:]]*FEATURES" /etc/portage/make.conf | wc -l)"
|
||||
if [ "${USE_DEFINITION_NUMBER}" -gt "1" ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of FEATURE variable in /etc/portage/make.conf, define the variable FEATURE only once in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Multiple definitions of FEATURE variable in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Else it's OK
|
||||
else
|
||||
echo -e "${GREEN}Portage getbinpkg feature CONFIGURED in /etc/portage/make.conf : check OK${NC}\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check if make.conf includes well configured PORTAGE_BINHOST
|
||||
echo "Check if /etc/portage/make.conf includes well configured PORTAGE_BINHOST"
|
||||
grep -q "^[[:space:]]*PORTAGE_BINHOST=\"${BINPKGREPO}\"[[:space:]]*$" /etc/portage/make.conf
|
||||
|
||||
# Return Code
|
||||
RC=$?
|
||||
|
||||
# Portage PORTAGE_BINHOST NOT well CONFIGURED
|
||||
if [ $RC -ne 0 ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Portage PORTAGE_BINHOST not configured, add PORTAGE_BINHOST=\"${BINPKGREPO}\" in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Portage PORTAGE_BINHOST NOT well CONFIGURED in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Portage PORTAGE_BINHOST well CONFIGURED
|
||||
else
|
||||
# If there are multiple definitions of PORTAGE_BINHOST variable, KO
|
||||
PORTAGE_BINHOST_DEFINITION_NUMBER="$(grep "^[[:space:]]*PORTAGE_BINHOST" /etc/portage/make.conf | wc -l)"
|
||||
if [ "${PORTAGE_BINHOST_DEFINITION_NUMBER}" -gt "1" ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of PORTAGE_BINHOST variable in /etc/portage/make.conf, define he variable PORTAGE_BINHOST only once in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Multiple definitions of PORTAGE_BINHOST variable in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Else it's OK
|
||||
else
|
||||
echo -e "${GREEN}Portage PORTAGE_BINHOST variable well CONFIGURED in /etc/portage/make.conf : check OK${NC}\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check if make.conf includes well configured ACCEPT_LICENSE
|
||||
echo "Check if /etc/portage/make.conf includes well configured ACCEPT_LICENSE"
|
||||
grep -q "^[[:space:]]*ACCEPT_LICENSE=\"${PORTAGE_ACCEPTLICENSE}\"[[:space:]]*$" /etc/portage/make.conf
|
||||
|
||||
# Return Code
|
||||
RC=$?
|
||||
|
||||
# Portage ACCEPT_LICENSE NOT well CONFIGURED
|
||||
if [ $RC -ne 0 ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Portage ACCEPT_LICENSE not configured, add ACCEPT_LICENSE=\"$(echo ${PORTAGE_ACCEPTLICENSE} | tr -d '\\')\" in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Portage ACCEPT_LICENSE feature NOT well CONFIGURED in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Portage ACCEPT_LICENSE well CONFIGURED
|
||||
else
|
||||
# If there are multiple definitions of ACCEPT_LICENSE variable, KO
|
||||
ACCEPT_LICENSE_DEFINITION_NUMBER="$(grep "^[[:space:]]*ACCEPT_LICENSE" /etc/portage/make.conf | wc -l)"
|
||||
if [ "${ACCEPT_LICENSE_DEFINITION_NUMBER}" -gt "1" ]
|
||||
then
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Multiple definitions of ACCEPT_LICENSE variable in /etc/portage/make.conf, define he variable ACCEPT_LICENSE only once in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Multiple definitions of ACCEPT_LICENSE variable in /etc/portage/make.conf : check KO${NC}\n"
|
||||
# Else it's OK
|
||||
else
|
||||
echo -e "${GREEN}Portage ACCEPT_LICENSE feature well CONFIGURED in /etc/portage/make.conf : check OK${NC}\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check if global USE flags is well configured in /etc/portage/make.conf
|
||||
echo "Check if global USE flags is well configured in /etc/portage/make.conf"
|
||||
|
||||
# Check if USE variable has multiple definiton
|
||||
USE_DEFINITION_NUMBER="$(grep "^[[:space:]]*USE" /etc/portage/make.conf | wc -l)"
|
||||
|
||||
# If there is only one definition, it's OK
|
||||
if [ "${USE_DEFINITION_NUMBER}" -eq "1" ]
|
||||
then
|
||||
# Get actual global USE flags in /etc/portage/make.conf and format to compare
|
||||
ACTUAL_PORTAGE_USE="$(sed -n '/^USE=\"/,/\"/p' /etc/portage/make.conf | tr -d '\n' | cut -d'"' -f2 | sed 's/ /\n/g' | sort | tr '\n' ' ' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||
PORTAGE_USE_SORTED="$(echo ${PORTAGE_USE} | sed 's/ /\n/g' | sort | tr '\n' ' ' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||
|
||||
# Global USE flags in /etc/portage/make.conf is well configured
|
||||
if [ "$ACTUAL_PORTAGE_USE" == "$PORTAGE_USE_SORTED" ]
|
||||
then
|
||||
echo -e "${GREEN}Global USE flags in /etc/portage/make.conf is well configured : check OK${NC}\n"
|
||||
# Global USE flags in NOT /etc/portage/make.conf is well configured
|
||||
else
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global USE flags in /etc/portage/make.conf is NOT well CONFIGURED, set USE=\"${PORTAGE_USE_SORTED}\" in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Global USE flags in /etc/portage/make.conf is NOT well CONFIGURED : check KO${NC}\n"
|
||||
fi
|
||||
else
|
||||
PORTAGE_CONFIG_CHECK_FAILED="${PORTAGE_CONFIG_CHECK_FAILED} Global USE flags in /etc/portage/make.conf has multiple definitions OR there is NO USE variable, define USE variable and only once in /etc/portage/make.conf ;"
|
||||
echo -e "${RED}Global USE flags in /etc/portage/make.conf has multiple definitions OR USE variable is not defined : check KO${NC}\n"
|
||||
fi
|
||||
|
||||
|
|
@ -39,4 +39,6 @@ print_config_title 'FINAL SUMMARY'
|
|||
|
||||
[ ! -z "${IPAM_CONFIG_CHECK_FAILED}" ] && echo -e "${RED}IPAM CONFIG TO CHECK :${NC} ${IPAM_CONFIG_CHECK_FAILED}\n"
|
||||
|
||||
[ ! -z "${PORTAGE_CONFIG_CHECK_FAILED}" ] && echo -e "${RED}PORTAGE CONFIG TO CHECK :${NC} ${PORTAGE_CONFIG_CHECK_FAILED}\n"
|
||||
|
||||
[ ${WRONG_GENTOO_PROFILE_SELECTED} -ne 0 ] && echo -e "${RED}Wrong Gentoo profile selecte :${NC} select ${GENTOO_PROFILE} profile with \"eselect profile list / set [ID]\"\n"
|
||||
|
|
31
vars.example
31
vars.example
|
@ -116,4 +116,33 @@ export PASSWORD_IPAM='password'
|
|||
export URL="https://ipam.example.tld/api/${USER_IPAM}"
|
||||
|
||||
# Gentoo profile
|
||||
export GENTOO_PROFILE="default/linux/amd64/17.1"
|
||||
export GENTOO_PROFILE='default/linux/amd64/17.1'
|
||||
|
||||
# FOR PORTAGE CHECK
|
||||
export BINPKGREPO='http://repo.example.com/build/'
|
||||
export PORTAGE_ACCEPTLICENSE='\* -@EULA' # Escape the asterisk
|
||||
export PORTAGE_USE='bash-completion
|
||||
-cairo
|
||||
dedicated
|
||||
gitcurl
|
||||
-graph-bindist
|
||||
-gtk3
|
||||
-gtk4
|
||||
leaps_timezone
|
||||
lm_sensors
|
||||
man
|
||||
munin
|
||||
openssl
|
||||
-pulseaudio
|
||||
-qt4
|
||||
-qt5
|
||||
-ruby
|
||||
-selinux
|
||||
server
|
||||
snmp
|
||||
symlink
|
||||
-systemd
|
||||
threads
|
||||
vim-pager
|
||||
vim-syntax'
|
||||
|
||||
|
|
Loading…
Reference in a new issue