blob: acd0d785cfd6e5c4f4ece6874e9b631bd89a5cca [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%/}
Nicolas De Loofacb86492014-10-24 13:43:13 +02009 rel=${f:23}
10 dir=$(dirname ${f})
Nicolas De Loofacb86492014-10-24 13:43:13 +020011 if [[ ! -e /var/jenkins_home/${rel} ]]
12 then
Nicolas De Loofacb86492014-10-24 13:43:13 +020013 mkdir -p /var/jenkins_home/${dir:23}
14 cp -r /usr/share/jenkins/ref/${rel} /var/jenkins_home/${rel};
15 fi;
16}
17export -f copy_reference_file
18find /usr/share/jenkins/ref/ -type f -exec bash -c 'copy_reference_file {}' \;
19
Nicolas De Loof07c307d2014-10-07 14:02:42 +020020# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
21if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
Nicolas De Looff744bdb2014-10-23 14:23:58 +020022 exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"
Nicolas De Loof07c307d2014-10-07 14:02:42 +020023fi
24
25# 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 +020026exec "$@"
Nicolas De Loofd6064382014-10-04 08:17:28 +020027