blob: 1bd0f8564a379903d0d544b38f79c234d0c80265 [file] [log] [blame]
Nicolas De Loofd6064382014-10-04 08:17:28 +02001#! /bin/bash
2
Nicolas De Loofacb86492014-10-24 13:43:13 +02003# 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
Nicolas De Loof07c307d2014-10-07 14:02:42 +020023# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
24if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
Nicolas De Looff744bdb2014-10-23 14:23:58 +020025 exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"
Nicolas De Loof07c307d2014-10-07 14:02:42 +020026fi
27
28# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
Nicolas De loofb2b442e2014-10-08 08:05:02 +020029exec "$@"
Nicolas De Loofd6064382014-10-04 08:17:28 +020030