#!/bin/sh -efu

. gb-sh-functions

fail_if_task_abort_requested

# This check is for new binary packages only.
[ -s plan/add-bin ] ||
	exit 0

. gb-sh-tmpdir

for arch in $GB_ARCH; do
	$0-arch "$arch" ||
		stamp_echo "[$arch] install check FAILED" >>"$tmpdir"/FAIL &
done

wait

if [ -s "$tmpdir"/FAIL ]; then
	cat >&2 "$tmpdir"/FAIL
	if is_check_failure_tolerated; then
		echo >&2 "The most essential install check failed, but \`$GB_REPO_NAME' is so neglected a repository that nobody cares about such trifles as this."
		exit 0
	fi
	exit 1
fi

# Do not stamp final OK because per-package install checks are already stamped.
exit 0
