|
1 #!@l_prefix@/bin/openpkg rc |
|
2 ## |
|
3 ## rc.git -- Run-Commands |
|
4 ## |
|
5 |
|
6 %config |
|
7 git_enable="$openpkg_rc_def" |
|
8 git_daemon="no" |
|
9 git_daemon_flags="" |
|
10 git_daemon_host="127.0.0.1" |
|
11 git_daemon_port="9418" |
|
12 git_daemon_user="@l_rusr@" |
|
13 git_daemon_group="@l_rgrp@" |
|
14 git_daemon_basedir="@l_prefix@/var/git/db" |
|
15 git_log_prolog="true" |
|
16 git_log_epilog="true" |
|
17 git_log_numfiles="10" |
|
18 git_log_minsize="1M" |
|
19 git_log_complevel="9" |
|
20 |
|
21 %common |
|
22 git_daemon_pidfile="@l_prefix@/var/git/run/git-daemon.pid" |
|
23 git_daemon_logfile="@l_prefix@/var/git/run/git-daemon.log" |
|
24 git_daemon_signal () { |
|
25 [ -f $git_daemon_pidfile ] && kill -$1 `cat $git_daemon_pidfile` |
|
26 } |
|
27 |
|
28 %status -u @l_susr@ -o |
|
29 git_usable="unknown" |
|
30 git_active="no" |
|
31 rcService git enable yes && \ |
|
32 rcVarIsYes git_daemon && \ |
|
33 git_daemon_signal 0 && \ |
|
34 git_active="yes" |
|
35 echo "git_enable=\"$git_enable\"" |
|
36 echo "git_usable=\"$git_usable\"" |
|
37 echo "git_active=\"$git_active\"" |
|
38 |
|
39 %start -u @l_susr@ |
|
40 rcService git enable yes || exit 0 |
|
41 rcService git active yes && exit 0 |
|
42 if rcVarIsYes git_daemon; then |
|
43 ( nohup @l_prefix@/bin/git daemon \ |
|
44 --reuseaddr \ |
|
45 --listen="$git_daemon_host" \ |
|
46 --port="$git_daemon_port" \ |
|
47 --user="$git_daemon_user" \ |
|
48 --group="$git_daemon_group" \ |
|
49 --base-path="$git_daemon_basedir" \ |
|
50 $git_daemon_flags \ |
|
51 </dev/null >>$git_daemon_logfile 2>&1 & |
|
52 echo $! >$git_daemon_pidfile |
|
53 ) </dev/null >/dev/null 2>&1 |
|
54 fi |
|
55 |
|
56 %stop -u @l_susr@ |
|
57 rcService git enable yes || exit 0 |
|
58 rcService git active no && exit 0 |
|
59 if rcVarIsYes git_daemon; then |
|
60 git_daemon_signal TERM |
|
61 sleep 1 |
|
62 rm -f $git_daemon_pidfile 2>/dev/null || true |
|
63 fi |
|
64 |
|
65 %restart -u @l_susr@ |
|
66 rcService git enable yes || exit 0 |
|
67 rcService git active no && exit 0 |
|
68 rc git stop start |
|
69 |
|
70 %daily -u @l_susr@ |
|
71 rcService git enable yes || exit 0 |
|
72 shtool rotate -f \ |
|
73 -n ${git_log_numfiles} -s ${git_log_minsize} -d \ |
|
74 -z ${git_log_complevel} -m 644 -o @l_rusr@ -g @l_rusr@ \ |
|
75 -P "${git_log_prolog}" \ |
|
76 -E "${git_log_epilog}" \ |
|
77 $git_daemon_logfile |
|
78 |