Fix check_dependencies.sh so it works on recent ubuntu linux as well as mac.

Note that, among many fixes, the psql postgres user test now utilizes 'sudo', which
was not used in any of the tests before. I believe this is necessary for ubuntu.