Some fixes for the setup script, and add the ability to use a service account when accessing the data from GCE.

BUG=skia:
R=mtklein@google.com, bensong@google.com

Author: jcgregorio@google.com

Review URL: https://codereview.chromium.org/335183002
diff --git a/perf/server/data.go b/perf/server/data.go
index eb419ec..7d2b3bc 100644
--- a/perf/server/data.go
+++ b/perf/server/data.go
@@ -17,6 +17,7 @@
 )
 
 import (
+	"code.google.com/p/goauth2/compute/serviceaccount"
 	"code.google.com/p/goauth2/oauth"
 	"code.google.com/p/google-api-go-client/bigquery/v2"
 	"github.com/oxtoacart/webbrowser"
@@ -458,7 +459,10 @@
 			return nil, fmt.Errorf("Failed to auth: %s", err)
 		}
 	} else {
-		client = http.DefaultClient
+		client, err = serviceaccount.NewClient(nil)
+		if err != nil {
+			return nil, fmt.Errorf("Failed to auth using a service account: %s", err)
+		}
 	}
 	service, err := bigquery.New(client)
 	if err != nil {
diff --git a/perf/server/perf.go b/perf/server/perf.go
index 3a30ba4..e5ec8d0 100644
--- a/perf/server/perf.go
+++ b/perf/server/perf.go
@@ -35,7 +35,7 @@
 // flags
 var (
 	port       = flag.String("port", ":8000", "HTTP service address (e.g., ':8000')")
-	doOauth    = flag.Bool("oauth", true, "Run through the OAuth 2.0 flow on startup.")
+	doOauth    = flag.Bool("oauth", true, "Run through the OAuth 2.0 flow on startup, otherwise use a GCE service account.")
 	gitRepoDir = flag.String("git_repo_dir", "../../../skia", "Directory location for the Skia repo.")
 )
 
diff --git a/perf/server/setup/continue_install b/perf/server/setup/continue_install
index 9934209..42be09b 100644
--- a/perf/server/setup/continue_install
+++ b/perf/server/setup/continue_install
@@ -17,12 +17,18 @@
 fi
 
 
-if [ -d buildbot]; then
+if [ -d buildbot ]; then
   (cd buildbot && git pull);
 else
   git clone https://skia.googlesource.com/buildbot
 fi
 
+if [ -d skia ]; then
+  (cd skia && git pull);
+else
+  git clone https://skia.googlesource.com/skia
+fi
+
 mkdir=$HOME/golib
 export GOROOT=$HOME/go
 export GOPATH=$HOME/golib
@@ -30,4 +36,4 @@
 
 cd ~/buildbot/perf/server
 go get -d
-go build perf.go
+go build -o perf
diff --git a/perf/server/setup/perf_setup.sh b/perf/server/setup/perf_setup.sh
index 9ded2d4..6a9d049 100755
--- a/perf/server/setup/perf_setup.sh
+++ b/perf/server/setup/perf_setup.sh
@@ -2,7 +2,7 @@
 #
 # Script to setup a GCE instance to run the perf server.
 # For full instructions see the README file.
-sudo apt-get install monit squid3 gcc
+sudo apt-get install monit squid3 gcc mercurial
 echo "Adding the perf user account"
 sudo adduser perf
 
@@ -18,3 +18,4 @@
 sudo chmod 744 /etc/init.d/perf
 # Confirm that monit is happy.
 sudo monit -t
+sudo /etc/init.d/perf restart
diff --git a/perf/server/setup/sys/perf_init b/perf/server/setup/sys/perf_init
index a8be1c8..fd15793 100644
--- a/perf/server/setup/sys/perf_init
+++ b/perf/server/setup/sys/perf_init
@@ -22,7 +22,7 @@
 DESC="The Skia perf application."
 NAME=perf
 DAEMON=/home/perf/buildbot/perf/server/$NAME
-DAEMON_ARGS=""
+DAEMON_ARGS="--oauth=false --git_repo_dir=/home/perf/skia"
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME