Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pre_check() {
	local __ _exit;
	for __ in ${CHECK_PATH_VARS}; do
		if [ -z "${___:=$(get_var_unsafe "${__}")}" ]; then
			log_msg failexit "Error: variable \`${__}' is empty or unset.";
		elif [ "${___#* *}" != "${___}" ]; then
			log_msg failexit "Error: variable \`${__}' contains one or more whitespace characters.";
		fi;
	done;
	for __ in ${CHECK_PREREQ_CMDS} $(eval echo ${CHECK_PREREQ_FILES_DYNAMIC}) ${CHECK_PREREQ_FILES}; do
		if [ "${__#/}" != "${__}" ]; then
			if [ ! -e "${__}" ]; then
				log_msg fail "Error: missing prerequisite file \`${__}'.";
				_exit=1;
			fi;
		else
			if ! test_cmd "${__}"; then
				log_msg fail "Error: missing prerequisite command \`${__}'.";
				_exit=1;
			fi;
		fi;
	done;
	for __ in ${CHECK_PREREQ_PERL_MODULES}; do
		if ! perl -M"${__}" -e "" 2>/dev/null; then
			log_msg fail "Error: missing prerequisite Perl module \`${__}'.";
			_exit=1;
		fi;
	done;
	if [ ${_exit:-0} = 1 ]; then
		exit 1;
	fi;
};

# vim:filetype=sh