Optionally disallow sudo and some refactoring

This add an option to disallow sudo access (to be passed to `Travis::Build.compile`).

It also extracts some of the bash code (fixes to resolv.conf, hosts etc) to bash templates so they're easier to read (also fixed the condition on the npm fix).