# test a use flag and return the result, possibly echo a non-empty string ifuse() { local flag=$1 local string_success=$2 local string_failure=$3 local success=0 # invert the return value for "!blah" and strip the '!' [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} } # Make sure we have this USE flag in IUSE if ! hasq "${flag}" ${IUSE} ${E_IUSE} && ! hasq "${flag}" ${PORTAGE_ARCHLIST} selinux; then eqawarn "QA Notice: USE Flag '${flag}' not in IUSE for ${CATEGORY}/${PF}" fi hasq "${flag}" ${USE} || ((success=1-success)) string=$( (( ${success} == 0 )) && echo ${string_success} || echo ${string_failure} ) [[ -n ${string} ]] && echo ${string} return ${success} } ifv() { [[ -n $1 ]] && echo $2 || echo $3 }