Recently tried this in a CPU-only situation with UBUNTU 14.04 LTS (Trusty). Omitted the GPU parts of the script and had to modify it a bit to get it working. Below is the version that worked for me:
Set up java (dependency for Bazel) Download jdk 8, for most recent version, go here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
mkdir jdk
cd jdk
Following wget
gives 'ERROR: 403 Forbidden', so just go to the oracle page to get the tarball.