Swap git daemon in xinetd for service
Add git-daemon init file to /etc/init.d and make sure the service is started. For transition, keep the git xinetd file and service defined but switch git service to stopped, we can remove this later. Change-Id: I0cf02c7292496e39695b80b00cdcb82ec7a61700
This commit is contained in:
parent
6d6441a3af
commit
a6e4c8952b
@ -4,7 +4,7 @@
|
||||
|
||||
service git
|
||||
{
|
||||
disable = no
|
||||
disable = yes
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = nobody
|
||||
|
@ -18,6 +18,7 @@ class cgit(
|
||||
$vhost_name = $::fqdn,
|
||||
$serveradmin = "webmaster@${::fqdn}",
|
||||
$cgitdir = '/var/www/cgit',
|
||||
$daemon_port = '29418',
|
||||
$staticfiles = '/var/www/cgit/static',
|
||||
$ssl_cert_file = '',
|
||||
$ssl_key_file = '',
|
||||
@ -119,10 +120,23 @@ class cgit(
|
||||
}
|
||||
|
||||
service { 'xinetd':
|
||||
ensure => running,
|
||||
ensure => stopped,
|
||||
subscribe => File['/etc/xinetd.d/git'],
|
||||
}
|
||||
|
||||
file { '/etc/init.d/git-daemon':
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
content => template('cgit/git-daemon.init.erb'),
|
||||
}
|
||||
|
||||
service { 'git-daemon':
|
||||
ensure => running,
|
||||
subscribe => File['/etc/init.d/git-daemon'],
|
||||
}
|
||||
|
||||
if $ssl_cert_file_contents != '' {
|
||||
file { $ssl_cert_file:
|
||||
owner => 'root',
|
||||
|
63
modules/cgit/templates/git-daemon.init.erb
Normal file
63
modules/cgit/templates/git-daemon.init.erb
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Startup/shutdown script for the git daemon
|
||||
# chkconfig: 345 56 10
|
||||
#
|
||||
# description: Startup/shutdown script for the git daemon
|
||||
#
|
||||
. /etc/init.d/functions
|
||||
|
||||
NAME=git-daemon
|
||||
USER=nobody
|
||||
DAEMON=/usr/libexec/git-core/git-daemon
|
||||
GIT_REPO=/var/lib/git
|
||||
PORT=<%= scope.lookupvar("cgit::daemon_port") %>
|
||||
ARGS="--base-path=/var/lib/git --user=$USER --export-all --syslog --detach --verbose --port=$PORT $GIT_REPO"
|
||||
|
||||
start () {
|
||||
echo -n $"Starting $NAME: "
|
||||
|
||||
# start daemon
|
||||
daemon $DAEMON $ARGS
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL = 0 ] && touch /var/lock/git-daemon
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop () {
|
||||
# stop daemon
|
||||
|
||||
echo -n $"Stopping $NAME: "
|
||||
killproc $DAEMON
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL = 0 ] && rm -f /var/lock/git-daemon
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status $DAEMON
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $NAME {start|stop|restart|status}"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
Loading…
Reference in New Issue
Block a user