Fix identification of installed packages in Ubuntu 14.04

Ubuntu 14.04 comes with an apt-get that produces slightly differently
formatted output, which makes our code for detecting installed packages
fail.  This adjusted code works with Ubuntu 14.04 as well as older
Ubuntu and Debian versions.