post_install() {

check_command() {
	local command="$1"

	local errors
	if ! errors="$("$@" 2>&1 1>/dev/null)"; then
		echo "$errors"
		echo "Failed to run the '$command' command."
		case "$errors" in
			# - https://github.com/termux/termux-packages/wiki/Termux-execution-environment#system-libraries-are-missing
			*"CANNOT LINK EXECUTABLE"*)
				printf '%s\n' \
					"To fix the '$command' command, manually upgrade all packages by running: \`pkg upgrade\`" \
					"If upgrading packages does not fix it, then please open an issue at https://github.com/termux/termux-packages/issues" \
					"See also: https://github.com/termux/termux-packages/wiki/Termux-execution-environment#dynamic-library-linking-errors"
			;;
			# - https://github.com/termux/termux-packages/issues/23189#issuecomment-2663464359
			# - https://cs.android.com/android/platform/superproject/+/android15-qpr1-release:external/boringssl/src/crypto/fipsmodule/bcm.c;l=141
			*"FIPS module doesn't span expected symbol"*)
				printf '%s\n' \
					"If you see this error, then please open an issue at https://github.com/termux/termux-packages/issues" \
					"See also: https://github.com/termux/termux-packages/wiki/Termux-execution-environment#dynamic-library-linking-errors"
			;;
		esac
		return 1
	fi
} 1>&2

check_command ffmpeg -version
}
