Fix script not necessarily working in the correct directory
diff --git a/install-plugins.sh b/install-plugins.sh
index 92e9894..37d0ccf 100755
--- a/install-plugins.sh
+++ b/install-plugins.sh
@@ -1,5 +1,15 @@
 #! /bin/bash
 
+# Resolve dependencies and download plugins given on the command line
+#
+# FROM jenkins
+# RUN install-plugins.sh docker-slaves github-branch-source
+
+set -e
+
+REF=/usr/share/jenkins/ref/plugins
+mkdir -p "$REF"
+
 function download() {
 	local plugin=$1; shift
 
@@ -62,6 +72,8 @@
 	touch ${plugin}.resolved
 }
 
+cd "$REF"
+
 for plugin in "$@"
 do
     download $plugin