7c0d2207a4
- Add missing $HOME for git-daemon script that may result in a fatal error at start (bnc#812893) (forwarded request 162392 from tiwai) OBS-URL: https://build.opensuse.org/request/show/162393 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/git?expand=0&rev=107
135 lines
3.3 KiB
Bash
135 lines
3.3 KiB
Bash
#!/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
|
|
|
|
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
|
|
|
|
pidfile=/var/run/git-daemon.pid
|
|
|
|
# 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}
|
|
|
|
: ${GIT_DAEMON_USER:=git-daemon}
|
|
: ${GIT_DAEMON_GROUP:=nogroup}
|
|
|
|
. /etc/rc.status
|
|
|
|
# Reset status of this service
|
|
rc_reset
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n "Starting git-daemon "
|
|
export HOME="$GIT_DAEMON_BASE_PATH"
|
|
/sbin/startproc -p $pidfile $git_daemon \
|
|
--syslog \
|
|
--detach \
|
|
--reuseaddr \
|
|
--user=${GIT_DAEMON_USER} \
|
|
--group=${GIT_DAEMON_GROUP} \
|
|
--pid-file=$pidfile \
|
|
--base-path="$GIT_DAEMON_BASE_PATH" \
|
|
$GIT_DAEMON_ARGS
|
|
|
|
rc_status -v
|
|
;;
|
|
stop)
|
|
echo -n "Shutting down git-daemon "
|
|
/sbin/killproc -p $pidfile $git_daemon -TERM
|
|
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 "
|
|
/sbin/checkproc -p $pidfile $git_daemon
|
|
rc_status -v
|
|
;;
|
|
probe)
|
|
test $git_daemon_config -nt $pidfile && echo reload
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
rc_exit
|