提交 b167b984 编写于 作者: M Monty Taylor

Deal with file existence in the proper order.

上级 f1f083a4
......@@ -5,7 +5,7 @@ usr/sbin
usr/share/jenkins
# this is where JENKINS_HOME is stored, so let's leave it as is for now
var/lib/hudson
var/lib/jenkins
# Need to create jenkins's own directory to track the pid since the daemon is not run as root
# and doesn't have permission to write the pid to /var/run (which would be the preferred location).
......
......@@ -21,11 +21,6 @@ set -e
case "$1" in
configure)
# If we have an old hudson install, rename it to jenkins
if test -d /var/lib/hudson ; then
mv /var/lib/hudson /var/lib/jenkins
fi
# Create jenkins user if it doesn't exist.
# sometimes tools that users want Jenkins to run need a shell,
# so use /bin/bash. See JENKINS-4830
......@@ -33,9 +28,22 @@ case "$1" in
adduser --system --home /var/lib/jenkins --no-create-home \
--ingroup nogroup --disabled-password --shell /bin/bash \
jenkins
find /var/lib/jenkins -user hudson -exec chown jenkins {} + || true
fi
# If we have an old hudson install, rename it to jenkins
if test -d /var/lib/hudson; then
# We need to ensure that the .??* wildcard matches something
touch /var/lib/hudson/.moving-hudson
mv -f /var/lib/hudson/* /var/lib/hudson/.??* /var/lib/jenkins
rmdir /var/lib/hudson
rm /var/lib/jenkins/.moving-hudson
find /var/lib/jenkins -user hudson -exec chown jenkins {} + || true
fi
if test -d /var/run/hudson; then
mv -f /var/run/hudson/* /var/run/jenkins
rmdir /var/run/hudson
fi
# Fix permissions on runtime directories/files.
# change group/owner to jenkins:adm - exclude jobs directory. See HUDSON-4047
# even if it fails on some files, don't let that interfere with the upgrade process
......@@ -51,7 +59,7 @@ case "$1" in
# delete old hudson user if it's still here
if id hudson > /dev/null 2>&1 ; then
deluser hudson || true
userdel hudson || true
fi
;;
......
......@@ -22,7 +22,7 @@ set -e
case "$1" in
purge)
userdel hudson || true
userdel jenkins || true
# TODO: remove log files rm -rf /var/log/jenkins
;;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册