#!/bin/bash

set -e -u

search_pkg()
{
		found=$(cd "$dist_dir"; ls -d ${pkg}_* 2>/dev/null || :)
		if [ "X$found" = "X" ]
		then
			echo "$pkg"
		else
			echo "ok $pkg" >&2
		fi
}

rel="7.2"
distro="jessie"

dist_dir="$PRJ/target/dists/$distro"

[ -d "$dist_dir" ] || {
	echo " error: dir not found '$dist_dir'" >&2
	echo " this command can be used only in devel environment" >&2
	exit 1
}

echo -e "\nCOMMON PKGS:" >&2
for pkg in $(sed -e 's/[[:space:]]*#.*//' pkgs-install-rel-$rel)
do
	search_pkg $pkg
done

for lang in en it de fr es
do
	echo -e "\nLANG: $lang" >&2

	for pkg in $(./listlocales $rel $lang)
	do
		search_pkg $pkg
	done
done

exit 0
