2008-06-23 21:54:16 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# SUSE system startup script for git-daemon
|
|
|
|
# Copyright (C) 1995-2008 SUSE / Novell Inc.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or (at
|
|
|
|
# your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
|
|
|
# USA.
|
|
|
|
#
|
|
|
|
# /etc/init.d/git-daemon
|
|
|
|
# and its symbolic link
|
|
|
|
# /usr/sbin/rcgit-daemon
|
|
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: git-daemon
|
|
|
|
# Required-Start: $syslog $remote_fs $network
|
|
|
|
# Required-Stop: $syslog $remote_fs
|
|
|
|
# Default-Start: 3 5
|
|
|
|
# Default-Stop: 0 1 2 6
|
|
|
|
# Short-Description: server for git repositories
|
|
|
|
# Description: server for git repositories
|
|
|
|
### END INIT INFO
|
|
|
|
|
2008-10-06 17:51:20 +02:00
|
|
|
if test -x /usr/lib64/git/git-daemon; then
|
|
|
|
git_daemon=/usr/lib64/git/git-daemon
|
|
|
|
elif test -x /usr/lib/git/git-daemon; then
|
|
|
|
git_daemon=/usr/lib/git/git-daemon
|
|
|
|
else
|
|
|
|
echo "git-daemon not installed"
|
|
|
|
if [ "$1" = "stop" ]; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2009-04-18 13:57:08 +02:00
|
|
|
pidfile=/var/run/git-daemon.pid
|
|
|
|
|
2008-06-23 21:54:16 +02:00
|
|
|
# Check for existence of needed config file and read it
|
|
|
|
git_daemon_config=/etc/sysconfig/git-daemon
|
|
|
|
test -r $git_daemon_config || { echo "$git_daemon_config not existing";
|
|
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
|
|
else exit 6; fi; }
|
|
|
|
|
|
|
|
# Read config
|
|
|
|
. $git_daemon_config
|
|
|
|
|
|
|
|
: ${GIT_DAEMON_BASE_PATH:=/srv/git}
|
|
|
|
|
2012-02-01 09:57:38 +01:00
|
|
|
: ${GIT_DAEMON_USER:=git-daemon}
|
|
|
|
: ${GIT_DAEMON_GROUP:=nogroup}
|
|
|
|
|
2008-06-23 21:54:16 +02:00
|
|
|
. /etc/rc.status
|
|
|
|
|
|
|
|
# Reset status of this service
|
|
|
|
rc_reset
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Starting git-daemon "
|
2013-04-05 13:22:52 +02:00
|
|
|
export HOME="$GIT_DAEMON_BASE_PATH"
|
2009-04-18 13:57:08 +02:00
|
|
|
/sbin/startproc -p $pidfile $git_daemon \
|
2008-06-23 21:54:16 +02:00
|
|
|
--syslog \
|
|
|
|
--detach \
|
|
|
|
--reuseaddr \
|
2012-02-01 09:57:38 +01:00
|
|
|
--user=${GIT_DAEMON_USER} \
|
|
|
|
--group=${GIT_DAEMON_GROUP} \
|
2009-04-18 13:57:08 +02:00
|
|
|
--pid-file=$pidfile \
|
2008-06-23 21:54:16 +02:00
|
|
|
--base-path="$GIT_DAEMON_BASE_PATH" \
|
|
|
|
$GIT_DAEMON_ARGS
|
|
|
|
|
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Shutting down git-daemon "
|
2009-04-18 13:57:08 +02:00
|
|
|
/sbin/killproc -p $pidfile $git_daemon -TERM
|
2008-06-23 21:54:16 +02:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
try-restart|condrestart)
|
|
|
|
if test "$1" = "condrestart"; then
|
|
|
|
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
|
|
|
fi
|
|
|
|
$0 status
|
|
|
|
if test $? = 0; then
|
|
|
|
$0 restart
|
|
|
|
else
|
|
|
|
rc_reset # Not running is not a failure.
|
|
|
|
fi
|
|
|
|
rc_status
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
## Stop the service and regardless of whether it was
|
|
|
|
## running or not, start it again.
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
|
|
|
|
# Remember status and be quiet
|
|
|
|
rc_status
|
|
|
|
;;
|
|
|
|
force-reload)
|
|
|
|
$0 try-restart
|
|
|
|
rc_status
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
echo -n "Reload service git-daemon "
|
|
|
|
## does not support reload
|
|
|
|
rc_failed 3
|
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
echo -n "Checking for service git-daemon "
|
2009-04-18 13:57:08 +02:00
|
|
|
/sbin/checkproc -p $pidfile $git_daemon
|
2008-06-23 21:54:16 +02:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
probe)
|
2009-04-18 13:57:08 +02:00
|
|
|
test $git_daemon_config -nt $pidfile && echo reload
|
2008-06-23 21:54:16 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
rc_exit
|