diff --git a/debian/debian/dirs b/debian/debian/dirs index b28de42fc637fed42bcfb649b01d01a2864bf84b..3ce5acbe376224588b8a659f8294cc95d3a53ece 100644 --- a/debian/debian/dirs +++ b/debian/debian/dirs @@ -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). diff --git a/debian/debian/jenkins.default b/debian/debian/jenkins.default index ce4316e9ba4531a418df6ac28d43012c4d15c9ac..8c17077bb039e69bed7bd42bca2fa319f33dd2c4 100644 --- a/debian/debian/jenkins.default +++ b/debian/debian/jenkins.default @@ -12,13 +12,13 @@ JAVA=/usr/bin/java PIDFILE=/var/run/jenkins/jenkins.pid # user id to be invoked as (otherwise will run as root; not wise!) -JENKINS_USER=hudson +JENKINS_USER=jenkins # location of the jenkins war file JENKINS_WAR=/usr/share/jenkins/jenkins.war -# hudson home location -JENKINS_HOME=/var/lib/hudson +# jenkins home location +JENKINS_HOME=/var/lib/jenkins # set this to false if you don't want Hudson to run by itself # in this set up, you are expected to provide a servlet containr diff --git a/debian/debian/jenkins.postinst b/debian/debian/jenkins.postinst index ae36abca72534101d099d1457153c2785189c8a3..dd90e59706c221217aae8b740330554e850a7557 100644 --- a/debian/debian/jenkins.postinst +++ b/debian/debian/jenkins.postinst @@ -21,27 +21,46 @@ set -e case "$1" in configure) - # Create hudson user if it doesn't exist. + # 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 - if ! id hudson > /dev/null 2>&1 ; then - adduser --system --home /var/lib/hudson --no-create-home \ + if ! id jenkins > /dev/null 2>&1 ; then + adduser --system --home /var/lib/jenkins --no-create-home \ --ingroup nogroup --disabled-password --shell /bin/bash \ - hudson + jenkins 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 hudson:adm - exclude jobs directory. See HUDSON-4047 + # 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 # (that can happen on dangling symlinks, for example.) - find /var/lib/hudson -path "*jobs" -prune -o -type l -prune -o -exec chown hudson:adm {} + || true - chown -R hudson:adm /var/run/jenkins /var/log/jenkins + find /var/lib/jenkins -path "*jobs" -prune -o -type l -prune -o -exec chown jenkins:adm {} + || true + chown -R jenkins:adm /var/run/jenkins /var/log/jenkins # change mode to 750 - exclude jobs and .ssh directories. See HUDSON-4047 # we prune symlinks instead of -P to avoid chmod/chown getting symlinks as arguments # (which ends up changing the target of the symlink, even though it's not recursive) - find /var/lib/hudson -path "*jobs" -prune -o -path "*.ssh" -prune -o -type l -prune -o -exec chmod 750 {} + || true + find /var/lib/jenkins -path "*jobs" -prune -o -path "*.ssh" -prune -o -type l -prune -o -exec chmod 750 {} + || true chmod -R 750 /var/run/jenkins chmod 750 /var/log/jenkins + + # delete old hudson user if it's still here + if id hudson > /dev/null 2>&1 ; then + userdel hudson || true + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/debian/jenkins.postrm b/debian/debian/jenkins.postrm index d9f6afbab656b6cb398b197a829e676e7fb52879..81ca7f2fef4d13e1ae7232ff57c7632999799b1b 100644 --- a/debian/debian/jenkins.postrm +++ b/debian/debian/jenkins.postrm @@ -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 ;;