Various setup.sh fixes

This was failing on a brand new installation (worked fine for redeploying where it had already been used).  Some fixes.  Works here now on a brand new Ubuntu 12.04 install.
@mithro as far as I'm aware (I've tested the script on new deployments, against a test deployment, against an existing prod environment) it still covers your original use case and should be OK