summaryrefslogtreecommitdiff
path: root/devel/monotone-server/files/monotone.sh
blob: 66e77f3e7638dc2da022a7a215846408ecbdf324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: monotone.sh,v 1.4 2006/04/10 17:46:31 jmmv Exp $
#
# PROVIDE: monotone
# REQUIRE: DAEMON

. /etc/rc.subr

if [ -f "@PKG_SYSCONFDIR@/rc.conf" ]; then
    . @PKG_SYSCONFDIR@/rc.conf
fi

if [ -f "@PKG_SYSCONFDIR@/branches.conf" ]; then
    monotone_branches=$(cat @PKG_SYSCONFDIR@/branches.conf | grep -v '^#')
fi

: ${monotone_group=@MONOTONE_GROUP@}
: ${monotone_home=@VARBASE@/monotone}
: ${monotone_user=@MONOTONE_USER@}

name="monotone"
rcvar=${name}
command="@PREFIX@/bin/mtn"
command_args="--norc \
              --confdir=@PKG_SYSCONFDIR@ \
              --db=${monotone_home}/monotone.db \
              --rcfile=@PKG_SYSCONFDIR@/hooks.conf \
              serve ${monotone_branches} \
              >>${monotone_home}/monotone.log 2>&1 &"
required_dirs="@PKG_SYSCONFDIR@/keys"
required_files="@PKG_SYSCONFDIR@/branches.conf \
                @PKG_SYSCONFDIR@/hooks.conf \
                @PKG_SYSCONFDIR@/read-permissions \
                @PKG_SYSCONFDIR@/write-permissions \
                ${monotone_home}/monotone.db"
start_precmd="monotone_start_precmd"

monotone_start_precmd() {
	if test ! -f ${monotone_home}/monotone.log; then
		touch ${monotone_home}/monotone.log
		chown ${monotone_user}:${monotone_group} \
			${monotone_home}/monotone.log
	fi
	echo "=> Session started at `date`" >>${monotone_home}/monotone.log
}

load_rc_config $name
run_rc_command "$1"