From a28669485770e6bf62adba52793b6d193ea88b76 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 8 Jan 2009 21:03:40 +0000 Subject: introducing git-daemon --- files/init.d/git-daemon | 73 +++++++++++++++++++++++++++++++++++++++ files/sysconfig/git-daemon | 23 ++++++++++++ files/sysconfig/git-daemon.vhosts | 24 +++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 files/init.d/git-daemon create mode 100644 files/sysconfig/git-daemon create mode 100644 files/sysconfig/git-daemon.vhosts (limited to 'files') diff --git a/files/init.d/git-daemon b/files/init.d/git-daemon new file mode 100644 index 0000000..f574480 --- /dev/null +++ b/files/init.d/git-daemon @@ -0,0 +1,73 @@ +#!/bin/bash +# puppet Init script for running the git-daemon +# +# Author: Marcel Haerry +# +# chkconfig: - 98 02 +# +# description: Enables the git-daemon to serve various directories. By default it serves /srv/git +# processname: git-daemon +# config: /etc/sysconfig/git-daemon + +PATH=/usr/bin:/sbin:/bin:/usr/sbin +export PATH + +[ -f /etc/sysconfig/git-daemon ] && . /etc/sysconfig/git-daemon +lockfile=${LOCKFILE-/var/lock/subsys/git-daemon} +gitdir=${GITDIR-/srv/git} +gitvhost=${GITVHOST-no} +options=${OPTIONS-"--reuseaddr --verbose --detach"} +gitdaemon=${GITDAEMON-/usr/bin/git-daemon} +RETVAL=0 + +if [ $gitvhost = yes ]; then + gitoptions="${options} --interpolated-path=${gitdir}/%H/%D" +else + gitoptions="${options} --base-path=${gitdir}" +fi + +# Source function library. +. /etc/rc.d/init.d/functions + +start() { + echo -n $"Starting git-daemon: " + daemon $gitdaemon $gitoptions + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch ${lockfile} + return $RETVAL +} + +stop() { + echo -n $"Stopping git-daemon: " + killproc $gitdaemon + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${lockfile} +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + status) + status $gitdaemon + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit $RETVAL diff --git a/files/sysconfig/git-daemon b/files/sysconfig/git-daemon new file mode 100644 index 0000000..92e66f2 --- /dev/null +++ b/files/sysconfig/git-daemon @@ -0,0 +1,23 @@ +# git-daemon config file + +# location of the lockfile +#LOCKFILE=/var/lock/subsys/git-daemon + +# which directory to server +#GITDIR=/srv/git + +# do we serve vhosts? +# setting this to yes assumes that you +# have in $GITDIR per vhost to serve +# a subdirectory containing their repos. +# for example: +# - /srv/git/git.example.com +# - /srv/git/git.example.org +#GITVHOST=no + +# options for the daemon +#OPTIONS="--reuseaddr --verbose --detach" + +# location of the daemon +#GITDAEMON=/usr/bin/git-daemon + diff --git a/files/sysconfig/git-daemon.vhosts b/files/sysconfig/git-daemon.vhosts new file mode 100644 index 0000000..dce800f --- /dev/null +++ b/files/sysconfig/git-daemon.vhosts @@ -0,0 +1,24 @@ +# git-daemon config file + +# location of the lockfile +#LOCKFILE=/var/lock/subsys/git-daemon + +# which directory to server +#GITDIR=/srv/git + +# do we serve vhosts? +# setting this to yes assumes that you +# have in $GITDIR per vhost to serve +# a subdirectory containing their repos. +# for example: +# - /srv/git/git.example.com +# - /srv/git/git.example.org +#GITVHOST=no +GITVHOST=yes + +# options for the daemon +#OPTIONS="--reuseaddr --verbose --detach" + +# location of the daemon +#GITDAEMON=/usr/bin/git-daemon + -- cgit v1.2.3