fix #18
copy files from /sur/share/jenkins/ref to jenkins_home
so jenkins_home can be initialized with some reference
configuration/plugins but still can be customized and
be persisted on a volume

utility script to install plugins at startup based on
support-core plugin format
diff --git a/jenkins.sh b/jenkins.sh
index 31dc7e4..1bd0f85 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -1,5 +1,25 @@
 #! /bin/bash
 
+# Copy files from /usr/share/jenkins/ref into /var/jenkins_home
+# So the initial JENKINS-HOME is set with expected content. 
+# Don't override, as this is just a reference setup, and use from UI 
+# can then change this, upgrade plugins, etc.
+copy_reference_file() {
+	f=${1%/} 
+	echo "$f"
+    rel=${f:23}
+    dir=$(dirname ${f})
+    echo " $f -> $rel"    
+	if [[ ! -e /var/jenkins_home/${rel} ]] 
+	then
+		echo "copy $rel to JENKINS_HOME"
+		mkdir -p /var/jenkins_home/${dir:23}
+		cp -r /usr/share/jenkins/ref/${rel} /var/jenkins_home/${rel}; 
+	fi; 
+}
+export -f copy_reference_file
+find /usr/share/jenkins/ref/ -type f -exec bash -c 'copy_reference_file {}' \;
+
 # if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
 if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
    exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"