version -- "$VERSION" 2>&1); then
		error "$VERSIONCHECK"
	fi
}

ensure_package_owns_file() {
	local PACKAGE="$1"
	local FILE="$2"

	if ! dpkg-query -L "$PACKAGE" | grep -F -q -x "$FILE"; then
		debug "File '$FILE' not owned by package " \
		      "'$PACKAGE', skipping $command"
		return 1
	fi
	return 0
}

internal_pkg_must_own_file()
{
	local PACKAGE="$1"
	local FILE="$2"

	if [ "$DPKG_MAINTSCRIPT_HELPER_INTERNAL_API" != "$version" ]; then
		error "internal API used by external command"
	fi

	if ! ensure_package_owns_file "$PACKAGE" "$FILE"; then
		error "file '$FILE' not owned by package '$PACKAGE'"
	fi
	return 0
}

symlink_match()
{
	local SYMLINK="$1"
	local SYMLINK_TARGET="$2"

	[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
	[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}

# Standard ANSI colors and attributes.
COLOR_NORMAL=''
COLOR_RESET='