提交 61e0a58a 编写于 作者: K Kohsuke Kawaguchi

renaming RPM to Jenkins.

For now, I'm leaving /var/lib/hudson and the user/group name intact,
as the users might have been using the 'hudson' user, and
/var/lib/hudson can contain some big data.
上级 b5314a11
[hudson]
name=Hudson
baseurl=http://pkg.hudson-labs.org/redhat/
gpgcheck=1
#!/bin/sh
#
# SUSE system statup script for Hudson
# SUSE system statup script for Jenkins
# Copyright (C) 2007 Pascal Bleser
#
# This library is free software; you can redistribute it and/or modify it
......@@ -19,92 +19,92 @@
# USA.
#
### BEGIN INIT INFO
# Provides: hudson
# Provides: jenkins
# Required-Start: $local_fs $remote_fs $network $time $named
# Should-Start: $time sendmail
# Required-Stop: $local_fs $remote_fs $network $time $named
# Should-Stop: $time sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Hudson continuous build server
# Description: Start the Hudson continuous build server
# Short-Description: Jenkins continuous build server
# Description: Start the Jenkins continuous build server
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
HUDSON_WAR="@@WAR@@"
test -r "$HUDSON_WAR" || { echo "$HUDSON_WAR not installed";
JENKINS_WAR="@@WAR@@"
test -r "$JENKINS_WAR" || { echo "$JENKINS_WAR not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
HUDSON_CONFIG=/etc/sysconfig/hudson
test -e "$HUDSON_CONFIG" || { echo "$HUDSON_CONFIG not existing";
JENKINS_CONFIG=/etc/sysconfig/jenkins
test -e "$JENKINS_CONFIG" || { echo "$JENKINS_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
test -r "$HUDSON_CONFIG" || { echo "$HUDSON_CONFIG not readable. Perhaps you forgot 'sudo'?";
test -r "$JENKINS_CONFIG" || { echo "$JENKINS_CONFIG not readable. Perhaps you forgot 'sudo'?";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
HUDSON_PID_FILE="/var/run/hudson.pid"
JENKINS_PID_FILE="/var/run/jenkins.pid"
# Source function library.
. /etc/init.d/functions
# Read config
[ -f "$HUDSON_CONFIG" ] && . "$HUDSON_CONFIG"
[ -f "$JENKINS_CONFIG" ] && . "$JENKINS_CONFIG"
# Set up environment accordingly to the configuration settings
[ -n "$HUDSON_HOME" ] || { echo "HUDSON_HOME not configured in $HUDSON_CONFIG";
[ -n "$JENKINS_HOME" ] || { echo "JENKINS_HOME not configured in $JENKINS_CONFIG";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
[ -d "$HUDSON_HOME" ] || { echo "HUDSON_HOME directory does not exist: $HUDSON_HOME";
[ -d "$JENKINS_HOME" ] || { echo "JENKINS_HOME directory does not exist: $JENKINS_HOME";
if [ "$1" = "stop" ]; then exit 0;
else exit 1; fi; }
export HUDSON_HOME
export JENKINS_HOME
# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java 1.5
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
for candidate in /usr/lib/jvm/java-1.6.0/bin/java /usr/lib/jvm/jre-1.6.0/bin/java /usr/lib/jvm/java-1.5.0/bin/java /usr/lib/jvm/jre-1.5.0/bin/java /usr/bin/java
do
[ -x "$HUDSON_JAVA_CMD" ] && break
HUDSON_JAVA_CMD="$candidate"
[ -x "$JENKINS_JAVA_CMD" ] && break
JENKINS_JAVA_CMD="$candidate"
done
JAVA_CMD="$HUDSON_JAVA_CMD $HUDSON_JAVA_OPTIONS -DHUDSON_HOME=$HUDSON_HOME -jar $HUDSON_WAR"
PARAMS="--logfile=/var/log/hudson/hudson.log --daemon"
[ -n "$HUDSON_PORT" ] && PARAMS="$PARAMS --httpPort=$HUDSON_PORT"
[ -n "$HUDSON_DEBUG_LEVEL" ] && PARAMS="$PARAMS --debug=$HUDSON_DEBUG_LEVEL"
[ -n "$HUDSON_HANDLER_STARTUP" ] && PARAMS="$PARAMS --handlerCountStartup=$HUDSON_HANDLER_STARTUP"
[ -n "$HUDSON_HANDLER_MAX" ] && PARAMS="$PARAMS --handlerCountMax=$HUDSON_HANDLER_MAX"
[ -n "$HUDSON_HANDLER_IDLE" ] && PARAMS="$PARAMS --handlerCountMaxIdle=$HUDSON_HANDLER_IDLE"
[ -n "$HUDSON_ARGS" ] && PARAMS="$PARAMS $HUDSON_ARGS"
JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DHUDSON_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
PARAMS="--logfile=/var/log/jenkins/jenkins.log --daemon"
[ -n "$JENKINS_PORT" ] && PARAMS="$PARAMS --httpPort=$JENKINS_PORT"
[ -n "$JENKINS_DEBUG_LEVEL" ] && PARAMS="$PARAMS --debug=$JENKINS_DEBUG_LEVEL"
[ -n "$JENKINS_HANDLER_STARTUP" ] && PARAMS="$PARAMS --handlerCountStartup=$JENKINS_HANDLER_STARTUP"
[ -n "$JENKINS_HANDLER_MAX" ] && PARAMS="$PARAMS --handlerCountMax=$JENKINS_HANDLER_MAX"
[ -n "$JENKINS_HANDLER_IDLE" ] && PARAMS="$PARAMS --handlerCountMaxIdle=$JENKINS_HANDLER_IDLE"
[ -n "$JENKINS_ARGS" ] && PARAMS="$PARAMS $JENKINS_ARGS"
if [ "$HUDSON_ENABLE_ACCESS_LOG" = "yes" ]; then
PARAMS="$PARAMS --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/hudson/access_log"
if [ "$JENKINS_ENABLE_ACCESS_LOG" = "yes" ]; then
PARAMS="$PARAMS --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/jenkins/access_log"
fi
RETVAL=0
case "$1" in
start)
echo -n "Starting Hudson "
daemon --user "$HUDSON_USER" --pidfile "$HUDSON_PID_FILE" $JAVA_CMD $PARAMS > /dev/null
echo -n "Starting Jenkins "
daemon --user "$JENKINS_USER" --pidfile "$JENKINS_PID_FILE" $JAVA_CMD $PARAMS > /dev/null
RETVAL=$?
if [ $RETVAL = 0 ]; then
success
echo > "$HUDSON_PID_FILE" # just in case we fail to find it
echo > "$JENKINS_PID_FILE" # just in case we fail to find it
MY_SESSION_ID=`/bin/ps h -o sess -p $$`
# get PID
/bin/ps hww -u "$HUDSON_USER" -o sess,ppid,pid,cmd | \
/bin/ps hww -u "$JENKINS_USER" -o sess,ppid,pid,cmd | \
while read sess ppid pid cmd; do
[ "$ppid" = 1 ] || continue
# this test doesn't work because Hudson sets a new Session ID
# this test doesn't work because Jenkins sets a new Session ID
# [ "$sess" = "$MY_SESSION_ID" ] || continue
echo "$cmd" | grep $HUDSON_WAR > /dev/null
echo "$cmd" | grep $JENKINS_WAR > /dev/null
[ $? = 0 ] || continue
# found a PID
echo $pid > "$HUDSON_PID_FILE"
echo $pid > "$JENKINS_PID_FILE"
done
else
failure
......@@ -112,8 +112,8 @@ case "$1" in
echo
;;
stop)
echo -n "Shutting down Hudson "
killproc hudson
echo -n "Shutting down Jenkins "
killproc jenkins
RETVAL=$?
echo
;;
......@@ -133,14 +133,14 @@ case "$1" in
$0 start
;;
force-reload)
echo -n "Reload service Hudson "
echo -n "Reload service Jenkins "
$0 try-restart
;;
reload)
$0 restart
;;
status)
status hudson
status jenkins
RETVAL=$?
;;
probe)
......@@ -148,7 +148,7 @@ case "$1" in
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.9)
test "$HUDSON_CONFIG" -nt "$HUDSON_PID_FILE" && echo reload
test "$JENKINS_CONFIG" -nt "$JENKINS_PID_FILE" && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
......
/var/log/hudson/hudson.log /var/log/hudson/access_log {
/var/log/jenkins/jenkins.log /var/log/jenkins/access_log {
compress
dateext
maxage 365
......@@ -8,6 +8,6 @@
missingok
create 644
postrotate
kill -SIGALRM `cat /var/run/hudson.pid`
kill -SIGALRM `cat /var/run/jenkins.pid`
endscript
}
[jenkins]
name=Jenkins
baseurl=http://pkg.jenkins-ci.org/redhat/
gpgcheck=1
## Path: Development/Hudson
## Description: Configuration for the Hudson continuous build server
## Path: Development/Jenkins
## Description: Configuration for the Jenkins continuous build server
## Type: string
## Default: "@@HOME@@"
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Directory where Hudson store its configuration and working
# Directory where Jenkins store its configuration and working
# files (checkouts, build reports, artifacts, ...).
#
HUDSON_HOME="@@HOME@@"
JENKINS_HOME="@@HOME@@"
## Type: string
## Default: ""
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Java executable to run Hudson
# Java executable to run Jenkins
# When left empty, we'll try to find the suitable Java.
#
HUDSON_JAVA_CMD=""
JENKINS_JAVA_CMD=""
## Type: string
## Default: "hudson"
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Unix user account that runs the Hudson daemon
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $HUDSON_HOME and /var/log/hudson.
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
HUDSON_USER="hudson"
JENKINS_USER="hudson"
## Type: string
## Default: "-Djava.awt.headless=true"
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Options to pass to java when running Hudson.
# Options to pass to java when running Jenkins.
#
HUDSON_JAVA_OPTIONS="-Djava.awt.headless=true"
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
## Type: integer(0:65535)
## Default: 8080
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Port Hudson is listening on.
# Port Jenkins is listening on.
#
HUDSON_PORT="8080"
JENKINS_PORT="8080"
## Type: integer(1:9)
## Default: 5
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Debug level for logs -- the higher the value, the more verbose.
# 5 is INFO.
#
HUDSON_DEBUG_LEVEL="5"
JENKINS_DEBUG_LEVEL="5"
## Type: yesno
## Default: no
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Whether to enable access logging or not.
#
HUDSON_ENABLE_ACCESS_LOG="no"
JENKINS_ENABLE_ACCESS_LOG="no"
## Type: integer
## Default: 100
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Maximum number of HTTP worker threads.
#
HUDSON_HANDLER_MAX="100"
JENKINS_HANDLER_MAX="100"
## Type: integer
## Default: 20
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Maximum number of idle HTTP worker threads.
#
HUDSON_HANDLER_IDLE="20"
JENKINS_HANDLER_IDLE="20"
## Type: string
## Default: ""
## ServiceRestart: hudson
## ServiceRestart: jenkins
#
# Pass arbitrary arguments to Hudson.
# Full option list: java -jar hudson.war --help
# Pass arbitrary arguments to Jenkins.
# Full option list: java -jar jenkins.war --help
#
HUDSON_ARGS=""
JENKINS_ARGS=""
# TODO:
# - how to add to the trusted service of the firewall?
%define _prefix %{_usr}/lib/hudson
%define _prefix %{_usr}/lib/jenkins
%define workdir %{_var}/lib/hudson
Name: hudson
Name: jenkins
Version: %{ver}
Release: 1.1
Summary: Continous Build Server
Source: hudson.war
Source1: hudson.init.in
Source2: hudson.sysconfig.in
Source3: hudson.logrotate
Source4: hudson.repo
URL: https://hudson.dev.java.net/
Source: jenkins.war
Source1: jenkins.init.in
Source2: jenkins.sysconfig.in
Source3: jenkins.logrotate
Source4: jenkins.repo
URL: http://jenkins-ci.org/
Group: Development/Tools/Building
License: MIT/X License, GPL/CDDL, ASL2
BuildRoot: %{_tmppath}/build-%{name}-%{version}
......@@ -71,7 +71,7 @@ rm -rf "%{buildroot}"
%__install -d "%{buildroot}%{workdir}"
%__install -d "%{buildroot}%{workdir}/plugins"
%__install -d "%{buildroot}/var/log/hudson"
%__install -d "%{buildroot}/var/log/jenkins"
%__install -D -m0755 "%{SOURCE1}" "%{buildroot}/etc/init.d/%{name}"
%__sed -i 's,@@WAR@@,%{_prefix}/%{name}.war,g' "%{buildroot}/etc/init.d/%{name}"
......@@ -82,7 +82,7 @@ rm -rf "%{buildroot}"
%__sed -i 's,@@HOME@@,%{workdir},g' "%{buildroot}/etc/sysconfig/%{name}"
%__install -D -m0644 "%{SOURCE3}" "%{buildroot}/etc/logrotate.d/%{name}"
%__install -D -m0644 "%{SOURCE4}" "%{buildroot}/etc/yum.repos.d/hudson.repo"
%__install -D -m0644 "%{SOURCE4}" "%{buildroot}/etc/yum.repos.d/jenkins.repo"
%pre
/usr/sbin/groupadd -r hudson &>/dev/null || :
......@@ -91,19 +91,19 @@ rm -rf "%{buildroot}"
-d "%{workdir}" hudson &>/dev/null || :
%post
/sbin/chkconfig --add hudson
/sbin/chkconfig --add jenkins
%preun
if [ "$1" = 0 ] ; then
# if this is uninstallation as opposed to upgrade, delete the service
/sbin/service hudson stop > /dev/null 2>&1
/sbin/chkconfig --del hudson
/sbin/service jenkins stop > /dev/null 2>&1
/sbin/chkconfig --del jenkins
fi
exit 0
%postun
if [ "$1" -ge 1 ]; then
/sbin/service hudson condrestart > /dev/null 2>&1
/sbin/service jenkins condrestart > /dev/null 2>&1
fi
exit 0
......@@ -115,11 +115,11 @@ exit 0
%dir %{_prefix}
%{_prefix}/%{name}.war
%attr(0755,hudson,hudson) %dir %{workdir}
%attr(0750,hudson,hudson) /var/log/hudson
%attr(0750,hudson,hudson) /var/log/jenkins
%config /etc/logrotate.d/%{name}
%config /etc/init.d/%{name}
%config /etc/sysconfig/%{name}
/etc/yum.repos.d/hudson.repo
/etc/yum.repos.d/jenkins.repo
/usr/sbin/rc%{name}
%changelog
......
#!/bin/bash -e
if [ -z "$1" ]; then
echo "Usage: build.sh path/to/hudson.war"
echo "Usage: build.sh path/to/jenkins.war"
exit 1
fi
sudo apt-get install -y rpm expect || true
# figure out the version to package
cp "$1" $(dirname $0)/SOURCES/hudson.war
cp "$1" $(dirname $0)/SOURCES/jenkins.war
pushd $(dirname $0)
version=$(unzip -p SOURCES/hudson.war META-INF/MANIFEST.MF | grep Implementation-Version | cut -d ' ' -f2 | tr - .)
version=$(unzip -p SOURCES/jenkins.war META-INF/MANIFEST.MF | grep Implementation-Version | cut -d ' ' -f2 | tr - .)
echo Version is $version
# prepare fresh directories
......@@ -17,4 +17,4 @@ rm -rf BUILD RPMS SRPMS tmp || true
mkdir -p BUILD RPMS SRPMS
# real action happens here
rpmbuild -ba --define="_topdir $PWD" --define="_tmppath $PWD/tmp" --define="ver $version" SPECS/hudson.spec
rpmbuild -ba --define="_topdir $PWD" --define="_tmppath $PWD/tmp" --define="ver $version" SPECS/jenkins.spec
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册