Add pkg_try_installed()

Like pkg_is_installed(), but "returns" the package if any is found.

The need comes from pkg_is_installed() not able to "return" in any way
the package found. pkg_try_installed() extends pkg_is_installed()
making possible to test and query to package in one function call.
pkg_is_installed() is a now simple wrapper around pkg_try_installed().
Fix panic triggered when pkg add'ing a package already installed.

The `pkg_inst' pointer in pkg_add() was initialized to NULL on
declaration and never changed, triggering an assert in pkg_get2().