Add debian packaging, and related minor fixes