Fix some incorrect behaviour when run on Linux
Fix some incorrect behaviour when run on Linux

* TMPDIR was being set without a trailing slash, and mktemp could not
  create `/tmpcf_home.XXXXXX`
* `open` does not exist on linux. test if it's available, and if not,
  use `xdg-open` instead.

alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf