michael@516: #!@l_prefix@/bin/openpkg rc michael@516: ## michael@516: ## rc.git -- Run-Commands michael@516: ## michael@516: michael@516: %config michael@516: git_enable="$openpkg_rc_def" michael@516: git_daemon="no" michael@516: git_daemon_flags="" michael@516: git_daemon_host="127.0.0.1" michael@516: git_daemon_port="9418" michael@516: git_daemon_user="@l_rusr@" michael@516: git_daemon_group="@l_rgrp@" michael@516: git_daemon_basedir="@l_prefix@/var/git/db" michael@516: git_log_prolog="true" michael@516: git_log_epilog="true" michael@516: git_log_numfiles="10" michael@516: git_log_minsize="1M" michael@516: git_log_complevel="9" michael@516: michael@516: %common michael@516: git_daemon_pidfile="@l_prefix@/var/git/run/git-daemon.pid" michael@516: git_daemon_logfile="@l_prefix@/var/git/run/git-daemon.log" michael@516: git_daemon_signal () { michael@516: [ -f $git_daemon_pidfile ] && kill -$1 `cat $git_daemon_pidfile` michael@516: } michael@516: michael@516: %status -u @l_susr@ -o michael@516: git_usable="unknown" michael@516: git_active="no" michael@516: rcService git enable yes && \ michael@516: rcVarIsYes git_daemon && \ michael@516: git_daemon_signal 0 && \ michael@516: git_active="yes" michael@516: echo "git_enable=\"$git_enable\"" michael@516: echo "git_usable=\"$git_usable\"" michael@516: echo "git_active=\"$git_active\"" michael@516: michael@516: %start -u @l_susr@ michael@516: rcService git enable yes || exit 0 michael@516: rcService git active yes && exit 0 michael@516: if rcVarIsYes git_daemon; then michael@516: ( nohup @l_prefix@/bin/git daemon \ michael@516: --reuseaddr \ michael@516: --listen="$git_daemon_host" \ michael@516: --port="$git_daemon_port" \ michael@516: --user="$git_daemon_user" \ michael@516: --group="$git_daemon_group" \ michael@516: --base-path="$git_daemon_basedir" \ michael@516: $git_daemon_flags \ michael@516: >$git_daemon_logfile 2>&1 & michael@516: echo $! >$git_daemon_pidfile michael@516: ) /dev/null 2>&1 michael@516: fi michael@516: michael@516: %stop -u @l_susr@ michael@516: rcService git enable yes || exit 0 michael@516: rcService git active no && exit 0 michael@516: if rcVarIsYes git_daemon; then michael@516: git_daemon_signal TERM michael@516: sleep 1 michael@516: rm -f $git_daemon_pidfile 2>/dev/null || true michael@516: fi michael@516: michael@516: %restart -u @l_susr@ michael@516: rcService git enable yes || exit 0 michael@516: rcService git active no && exit 0 michael@516: rc git stop start michael@516: michael@516: %daily -u @l_susr@ michael@516: rcService git enable yes || exit 0 michael@516: shtool rotate -f \ michael@516: -n ${git_log_numfiles} -s ${git_log_minsize} -d \ michael@516: -z ${git_log_complevel} -m 644 -o @l_rusr@ -g @l_rusr@ \ michael@516: -P "${git_log_prolog}" \ michael@516: -E "${git_log_epilog}" \ michael@516: $git_daemon_logfile michael@516: