Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2 from jieryn/JENKINS-23273
[FIXED JENKINS-23273] /etc/sysconfig option to skip (off default) lon…
  • Loading branch information
kohsuke committed Jun 5, 2015
2 parents dab31b6 + 1e4744e commit 58084e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions rpm/build/SOURCES/jenkins.sysconfig.in
Expand Up @@ -29,6 +29,16 @@ JENKINS_JAVA_CMD=""
JENKINS_USER="@@ARTIFACTNAME@@"

## Type: string
## Default: "false"
## ServiceRestart: jenkins
#
# Whether to skip potentially long-running chown at the
# $JENKINS_HOME location. Do not enable this, "true", unless
# you know what you're doing. See JENKINS-23273.
#
#JENKINS_INSTALL_SKIP_CHOWN="false"

## Type: string
## Default: "-Djava.awt.headless=true"
## ServiceRestart: @@ARTIFACTNAME@@
#
Expand Down
7 changes: 5 additions & 2 deletions rpm/build/SPECS/jenkins.spec
Expand Up @@ -110,8 +110,11 @@ fi

# Ensure the right ownership on files
. /etc/sysconfig/%{name}
chown -R ${JENKINS_USER:-%{name}} /var/log/%{name}
chown -R ${JENKINS_USER:-%{name}} ${JENKINS_HOME:-%{workdir}}
if test ( "x"$JENKINS_INSTALL_SKIP_CHOWN != "xtrue" ); then

This comment has been minimized.

Copy link
@KostyaSha

KostyaSha Jun 8, 2015

Member

@afx114 pointed in IRC on problems with this code. Though this shouldn't influence because expected values: true/false, but shell variable must be escaped and not a x-trick.

This comment has been minimized.

Copy link
@jsnod

jsnod Jun 8, 2015

Yep, here's what I get on CentOS release 6.6 after a yum install jenkins:

Running Transaction
  Installing : jenkins-1.617-1.1.noarch                                                                                                                                                                                                                                   1/1 
Non-fatal POSTIN scriptlet failure in rpm package jenkins-1.617-1.1.noarch
/var/tmp/rpm-tmp.lEmlqZ: line 20: syntax error near unexpected token `"x"$JENKINS_INSTALL_SKIP_CHOWN'
/var/tmp/rpm-tmp.lEmlqZ: line 20: `if test ( "x"$JENKINS_INSTALL_SKIP_CHOWN != "xtrue" ); then'
warning: %post(jenkins-1.617-1.1.noarch) scriptlet failed, exit status 2

jenkins-1.616-1.1 installs just fine.

This comment has been minimized.

Copy link
@jamie-sparked

jamie-sparked Jun 8, 2015

I think you just need to remove the parens

[bash] if test ( foo != bar ); then echo hey; fi
-bash: syntax error near unexpected token `foo'
[bash] if test foo != bar; then echo hey; fi
hey

The parens are reserved for creating subshells and are not needed.

This comment has been minimized.

Copy link
@KostyaSha

KostyaSha Jun 8, 2015

Member

opened PR #3

chown -R ${JENKINS_USER:-%{name}} /var/cache/%{name}
chown -R ${JENKINS_USER:-%{name}} /var/log/%{name}
chown -R ${JENKINS_USER:-%{name}} ${JENKINS_HOME:-%{workdir}}
fi

%preun
if [ "$1" = 0 ] ; then
Expand Down

0 comments on commit 58084e5

Please sign in to comment.