Wed, 08 Feb 2012 20:07:00 +0200
Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.
michael@516 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@516 | 2 | ## |
michael@516 | 3 | ## rc.git -- Run-Commands |
michael@516 | 4 | ## |
michael@516 | 5 | |
michael@516 | 6 | %config |
michael@516 | 7 | git_enable="$openpkg_rc_def" |
michael@516 | 8 | git_daemon="no" |
michael@516 | 9 | git_daemon_flags="" |
michael@516 | 10 | git_daemon_host="127.0.0.1" |
michael@516 | 11 | git_daemon_port="9418" |
michael@516 | 12 | git_daemon_user="@l_rusr@" |
michael@516 | 13 | git_daemon_group="@l_rgrp@" |
michael@516 | 14 | git_daemon_basedir="@l_prefix@/var/git/db" |
michael@516 | 15 | git_log_prolog="true" |
michael@516 | 16 | git_log_epilog="true" |
michael@516 | 17 | git_log_numfiles="10" |
michael@516 | 18 | git_log_minsize="1M" |
michael@516 | 19 | git_log_complevel="9" |
michael@516 | 20 | |
michael@516 | 21 | %common |
michael@516 | 22 | git_daemon_pidfile="@l_prefix@/var/git/run/git-daemon.pid" |
michael@516 | 23 | git_daemon_logfile="@l_prefix@/var/git/run/git-daemon.log" |
michael@516 | 24 | git_daemon_signal () { |
michael@516 | 25 | [ -f $git_daemon_pidfile ] && kill -$1 `cat $git_daemon_pidfile` |
michael@516 | 26 | } |
michael@516 | 27 | |
michael@516 | 28 | %status -u @l_susr@ -o |
michael@516 | 29 | git_usable="unknown" |
michael@516 | 30 | git_active="no" |
michael@516 | 31 | rcService git enable yes && \ |
michael@516 | 32 | rcVarIsYes git_daemon && \ |
michael@516 | 33 | git_daemon_signal 0 && \ |
michael@516 | 34 | git_active="yes" |
michael@516 | 35 | echo "git_enable=\"$git_enable\"" |
michael@516 | 36 | echo "git_usable=\"$git_usable\"" |
michael@516 | 37 | echo "git_active=\"$git_active\"" |
michael@516 | 38 | |
michael@516 | 39 | %start -u @l_susr@ |
michael@516 | 40 | rcService git enable yes || exit 0 |
michael@516 | 41 | rcService git active yes && exit 0 |
michael@516 | 42 | if rcVarIsYes git_daemon; then |
michael@516 | 43 | ( nohup @l_prefix@/bin/git daemon \ |
michael@516 | 44 | --reuseaddr \ |
michael@516 | 45 | --listen="$git_daemon_host" \ |
michael@516 | 46 | --port="$git_daemon_port" \ |
michael@516 | 47 | --user="$git_daemon_user" \ |
michael@516 | 48 | --group="$git_daemon_group" \ |
michael@516 | 49 | --base-path="$git_daemon_basedir" \ |
michael@516 | 50 | $git_daemon_flags \ |
michael@516 | 51 | </dev/null >>$git_daemon_logfile 2>&1 & |
michael@516 | 52 | echo $! >$git_daemon_pidfile |
michael@516 | 53 | ) </dev/null >/dev/null 2>&1 |
michael@516 | 54 | fi |
michael@516 | 55 | |
michael@516 | 56 | %stop -u @l_susr@ |
michael@516 | 57 | rcService git enable yes || exit 0 |
michael@516 | 58 | rcService git active no && exit 0 |
michael@516 | 59 | if rcVarIsYes git_daemon; then |
michael@516 | 60 | git_daemon_signal TERM |
michael@516 | 61 | sleep 1 |
michael@516 | 62 | rm -f $git_daemon_pidfile 2>/dev/null || true |
michael@516 | 63 | fi |
michael@516 | 64 | |
michael@516 | 65 | %restart -u @l_susr@ |
michael@516 | 66 | rcService git enable yes || exit 0 |
michael@516 | 67 | rcService git active no && exit 0 |
michael@516 | 68 | rc git stop start |
michael@516 | 69 | |
michael@516 | 70 | %daily -u @l_susr@ |
michael@516 | 71 | rcService git enable yes || exit 0 |
michael@516 | 72 | shtool rotate -f \ |
michael@516 | 73 | -n ${git_log_numfiles} -s ${git_log_minsize} -d \ |
michael@516 | 74 | -z ${git_log_complevel} -m 644 -o @l_rusr@ -g @l_rusr@ \ |
michael@516 | 75 | -P "${git_log_prolog}" \ |
michael@516 | 76 | -E "${git_log_epilog}" \ |
michael@516 | 77 | $git_daemon_logfile |
michael@516 | 78 |