Nicolas De Loof | d606438 | 2014-10-04 08:17:28 +0200 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame^] | 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. |
| 7 | copy_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 | } |
| 20 | export -f copy_reference_file |
| 21 | find /usr/share/jenkins/ref/ -type f -exec bash -c 'copy_reference_file {}' \; |
| 22 | |
Nicolas De Loof | 07c307d | 2014-10-07 14:02:42 +0200 | [diff] [blame] | 23 | # if `docker run` first argument start with `--` the user is passing jenkins launcher arguments |
| 24 | if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then |
Nicolas De Loof | f744bdb | 2014-10-23 14:23:58 +0200 | [diff] [blame] | 25 | exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@" |
Nicolas De Loof | 07c307d | 2014-10-07 14:02:42 +0200 | [diff] [blame] | 26 | fi |
| 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 loof | b2b442e | 2014-10-08 08:05:02 +0200 | [diff] [blame] | 29 | exec "$@" |
Nicolas De Loof | d606438 | 2014-10-04 08:17:28 +0200 | [diff] [blame] | 30 | |