1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/git/rc.git Fri Aug 10 14:40:03 2012 +0200 1.3 @@ -0,0 +1,78 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.git -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + git_enable="$openpkg_rc_def" 1.11 + git_daemon="no" 1.12 + git_daemon_flags="" 1.13 + git_daemon_host="127.0.0.1" 1.14 + git_daemon_port="9418" 1.15 + git_daemon_user="@l_rusr@" 1.16 + git_daemon_group="@l_rgrp@" 1.17 + git_daemon_basedir="@l_prefix@/var/git/db" 1.18 + git_log_prolog="true" 1.19 + git_log_epilog="true" 1.20 + git_log_numfiles="10" 1.21 + git_log_minsize="1M" 1.22 + git_log_complevel="9" 1.23 + 1.24 +%common 1.25 + git_daemon_pidfile="@l_prefix@/var/git/run/git-daemon.pid" 1.26 + git_daemon_logfile="@l_prefix@/var/git/run/git-daemon.log" 1.27 + git_daemon_signal () { 1.28 + [ -f $git_daemon_pidfile ] && kill -$1 `cat $git_daemon_pidfile` 1.29 + } 1.30 + 1.31 +%status -u @l_susr@ -o 1.32 + git_usable="unknown" 1.33 + git_active="no" 1.34 + rcService git enable yes && \ 1.35 + rcVarIsYes git_daemon && \ 1.36 + git_daemon_signal 0 && \ 1.37 + git_active="yes" 1.38 + echo "git_enable=\"$git_enable\"" 1.39 + echo "git_usable=\"$git_usable\"" 1.40 + echo "git_active=\"$git_active\"" 1.41 + 1.42 +%start -u @l_susr@ 1.43 + rcService git enable yes || exit 0 1.44 + rcService git active yes && exit 0 1.45 + if rcVarIsYes git_daemon; then 1.46 + ( nohup @l_prefix@/bin/git daemon \ 1.47 + --reuseaddr \ 1.48 + --listen="$git_daemon_host" \ 1.49 + --port="$git_daemon_port" \ 1.50 + --user="$git_daemon_user" \ 1.51 + --group="$git_daemon_group" \ 1.52 + --base-path="$git_daemon_basedir" \ 1.53 + $git_daemon_flags \ 1.54 + </dev/null >>$git_daemon_logfile 2>&1 & 1.55 + echo $! >$git_daemon_pidfile 1.56 + ) </dev/null >/dev/null 2>&1 1.57 + fi 1.58 + 1.59 +%stop -u @l_susr@ 1.60 + rcService git enable yes || exit 0 1.61 + rcService git active no && exit 0 1.62 + if rcVarIsYes git_daemon; then 1.63 + git_daemon_signal TERM 1.64 + sleep 1 1.65 + rm -f $git_daemon_pidfile 2>/dev/null || true 1.66 + fi 1.67 + 1.68 +%restart -u @l_susr@ 1.69 + rcService git enable yes || exit 0 1.70 + rcService git active no && exit 0 1.71 + rc git stop start 1.72 + 1.73 +%daily -u @l_susr@ 1.74 + rcService git enable yes || exit 0 1.75 + shtool rotate -f \ 1.76 + -n ${git_log_numfiles} -s ${git_log_minsize} -d \ 1.77 + -z ${git_log_complevel} -m 644 -o @l_rusr@ -g @l_rusr@ \ 1.78 + -P "${git_log_prolog}" \ 1.79 + -E "${git_log_epilog}" \ 1.80 + $git_daemon_logfile 1.81 +