mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 11:36:05 +01:00
System support for RedHat
This commit is adding init.d script and sysconfig file which allows to run GitBucket in the standalone mode. It also adds the spec file which allows to build RPM package.
This commit is contained in:
14
contrib/redhat/gitbucket.conf
Normal file
14
contrib/redhat/gitbucket.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
# Server port
|
||||
#GITBUCKET_PORT=8080
|
||||
|
||||
# Data directory (GITBUCKET_HOME/gitbucket)
|
||||
#GITBUCKET_HOME=/var/lib/gitbucket
|
||||
|
||||
# Path to the WAR file
|
||||
#GITBUCKET_WAR_FILE=/usr/share/gitbucket/lib/gitbucket.war
|
||||
|
||||
# URL prefix for the GitBucket page (http://<host>:<port>/<prefix>/)
|
||||
#GITBUCKET_PREFIX=
|
||||
|
||||
# Other Java option
|
||||
#GITBUCKET_JVM_OPTS=
|
||||
102
contrib/redhat/gitbucket.init
Normal file
102
contrib/redhat/gitbucket.init
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.d/init.d/gitbucket
|
||||
#
|
||||
# Starts the GitBucket server
|
||||
#
|
||||
# chkconfig: 345 60 40
|
||||
# description: Run GitBucket server
|
||||
# processname: java
|
||||
|
||||
# Source function library
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Default values
|
||||
GITBUCKET_PORT=8080
|
||||
GITBUCKET_HOME=/var/lib/gitbucket
|
||||
GITBUCKET_WAR_FILE=/usr/share/gitbucket/lib/gitbucket.war
|
||||
|
||||
# Pull in cq settings
|
||||
[ -f /etc/sysconfig/gitbucket ] && . /etc/sysconfig/gitbucket
|
||||
|
||||
# Location of the log and PID file
|
||||
LOG_FILE=/var/log/gitbucket/run.log
|
||||
PID_FILE=/var/run/gitbucket.pid
|
||||
|
||||
# Default return value
|
||||
RETVAL=0
|
||||
|
||||
|
||||
start() {
|
||||
echo -n $"Starting GitBucket server: "
|
||||
|
||||
# Compile statup parameters
|
||||
START_OPTS="--port=${GITBUCKET_PORT}"
|
||||
if [ $GITBUCKET_PREFIX ]; then
|
||||
START_OPTS="${START_OPTS} --prefix ${GITBUCKET_PREFIX}"
|
||||
fi
|
||||
|
||||
# Run the Java process
|
||||
GITBUCKET_HOME="${GITBUCKET_HOME}" java $GITBUCKET_JVM_OPTS -jar $GITBUCKET_WAR_FILE $START_OPTS >>$LOG_FILE 2>&1 &
|
||||
RETVAL=$?
|
||||
|
||||
# Store PID of the Java process into a file
|
||||
echo $! > $PID_FILE
|
||||
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
success "GitBucket startup"
|
||||
else
|
||||
failure "GitBucket startup"
|
||||
fi
|
||||
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping GitBucket server: "
|
||||
|
||||
# Run the Java process
|
||||
kill $(cat $PID_FILE 2>/dev/null) >>$LOG_FILE 2>&1
|
||||
RETVAL=$?
|
||||
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
rm -f $PID_FILE
|
||||
success "GitBucket stopping"
|
||||
else
|
||||
failure "GitBucket stopping"
|
||||
fi
|
||||
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status -p $PID_FILE java
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 [start|stop|restart|status]"
|
||||
RETVAL=2
|
||||
esac
|
||||
|
||||
|
||||
exit $RETVAL
|
||||
44
contrib/redhat/gitbucket.spec
Normal file
44
contrib/redhat/gitbucket.spec
Normal file
@@ -0,0 +1,44 @@
|
||||
Name: gitbucket
|
||||
Summary: Github clone written with Scala.
|
||||
Version: 1.6
|
||||
Release: 1%{?dist}
|
||||
License: Apache
|
||||
URL: https://github.com/takezoe/gitbucket
|
||||
Group: System/Servers
|
||||
Source0: %{name}.war
|
||||
Source1: %{name}.init
|
||||
Source2: %{name}.conf
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
BuildArch: noarch
|
||||
Requires: java >= 1.7
|
||||
|
||||
|
||||
%description
|
||||
|
||||
GitBucket is the easily installable Github clone written with Scala.
|
||||
|
||||
|
||||
%install
|
||||
[ "%{buildroot}" != / ] && %{__rm} -rf "%{buildroot}"
|
||||
%{__mkdir_p} %{buildroot}{%{_sysconfdir}/{init.d,sysconfig},%{_datarootdir}/%{name}/lib,%{_sharedstatedir}/%{name},%{_localstatedir}/log/%{name}}
|
||||
%{__install} -m 0644 %{SOURCE0} %{buildroot}%{_datarootdir}/%{name}/lib
|
||||
%{__install} -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
|
||||
%{__install} -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||||
touch %{buildroot}%{_localstatedir}/log/%{name}/run.log
|
||||
|
||||
|
||||
%clean
|
||||
[ "%{buildroot}" != / ] && %{__rm} -rf "%{buildroot}"
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_datarootdir}/%{name}/lib/%{name}.war
|
||||
%{_sysconfdir}/init.d/%{name}
|
||||
%config %{_sysconfdir}/sysconfig/%{name}
|
||||
%{_localstatedir}/log/%{name}/run.log
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Oct 17 2013 Jiri Tyr <jiri_DOT_tyr at gmail.com>
|
||||
- First build.
|
||||
Reference in New Issue
Block a user