fix test to support non-multiarch dpkg versions

On travis we work with a pre-multiarch version of dpkg, so the output is
slightly different in regards to package names.

Git-Dch: Ignore
use dpkg --merge-avail only if needed in apt-mark

Only "recent" versions of dpkg support stdin for merge instead of a
file, so as a quick fix we delay calling it until we really need it
which fixes most of the problem already.

Checking for a specific dpkg version here is deemed too much work, just
like using a temporary file here and depends a too high requirement for
this minor usecase. After all, it didn't work at all before, so we break
nobody here and can fix it if someone complains (with a patch).