blob: 1bd0f8564a379903d0d544b38f79c234d0c80265 [file] [log] [blame]
Nicolas De Looffb6f4542014-12-02 16:41:07 +01001#! /bin/bash
2
3# Copy files from /usr/share/jenkins/ref into /var/jenkins_home
4# So the initial JENKINS-HOME is set with expected content.
5# Don't override, as this is just a reference setup, and use from UI
6# can then change this, upgrade plugins, etc.
7copy_reference_file() {
8 f=${1%/}
9 echo "$f"
10 rel=${f:23}
11 dir=$(dirname ${f})
12 echo " $f -> $rel"
13 if [[ ! -e /var/jenkins_home/${rel} ]]
14 then
15 echo "copy $rel to JENKINS_HOME"
16 mkdir -p /var/jenkins_home/${dir:23}
17 cp -r /usr/share/jenkins/ref/${rel} /var/jenkins_home/${rel};
18 fi;
19}
20export -f copy_reference_file
21find /usr/share/jenkins/ref/ -type f -exec bash -c 'copy_reference_file {}' \;
22
23# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
24if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
25 exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"
26fi
27
28# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
29exec "$@"
30