Skip to content

Commit

Permalink
Merge pull request jenkinsci#214 from dhrapson/master
Browse files Browse the repository at this point in the history
replace hard-coded /var/jenkins_home with $JENKINS_HOME
  • Loading branch information
carlossg committed Mar 16, 2016
2 parents e9f9095 + 595a468 commit 9b2d222
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

# Copy files from /usr/share/jenkins/ref into /var/jenkins_home
# Copy files from /usr/share/jenkins/ref into $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.
Expand All @@ -13,15 +13,16 @@ copy_reference_file() {
rel="${b:23}"
dir=$(dirname "${b}")
echo " $f -> $rel" >> "$COPY_REFERENCE_FILE_LOG"
if [[ ! -e /var/jenkins_home/${rel} || $f = *.override ]]
if [[ ! -e $JENKINS_HOME/${rel} || $f = *.override ]]
then
echo "copy $rel to JENKINS_HOME" >> "$COPY_REFERENCE_FILE_LOG"
mkdir -p "/var/jenkins_home/${dir:23}"
cp -r "${f}" "/var/jenkins_home/${rel}";
mkdir -p "$JENKINS_HOME/${dir:23}"
cp -r "${f}" "$JENKINS_HOME/${rel}";
# pin plugins on initial copy
[[ ${rel} == plugins/*.jpi ]] && touch "/var/jenkins_home/${rel}.pinned"
[[ ${rel} == plugins/*.jpi ]] && touch "$JENKINS_HOME/${rel}.pinned"
fi;
}
: ${JENKINS_HOME:="/var/jenkins_home"}
export -f copy_reference_file
touch "${COPY_REFERENCE_FILE_LOG}" || (echo "Can not write to ${COPY_REFERENCE_FILE_LOG}. Wrong volume permissions?" && exit 1)
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
Expand Down

0 comments on commit 9b2d222

Please sign in to comment.