summaryrefslogtreecommitdiff
blob: c059f96a26cbfd51a6fe10ea6d2aaad3f4c9a765 (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
50
51
52
53
54
55
56
57
58
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-fs/coda/files/coda-update,v 1.3 2004/07/16 23:22:03 dragonheart Exp $

depend() {
	need net auth2
}

we_are_scm() {
	if [ "`cat $vicedir/hostname`" = "`cat $vicedir/db/scm`" ] ; then
		return 0
	else
		return 1
	fi
}

checkconfig() {

        if [ ! -e /etc/coda/server.conf ] ; then
                eerror "Please run vice-setup before starting the service..."
                return 1
        fi
        eval `grep "^vicedir=" /etc/coda/server.conf || echo vicedir=/var/lib/vice`
        if [ ! -e $vicedir/hostname ] ; then
                eerror "Please run vice-setup before starting the service..."
                return 1
        fi
}

start() {
	checkconfig || return 1

	ebegin "Starting coda update servers"

	# Check to see if we are the SCM.
	if we_are_scm ; then
		start-stop-daemon --start --quiet --exec /usr/sbin/rpc2portmap
		start-stop-daemon --start --quiet --exec /usr/sbin/updatesrv
	fi

	start-stop-daemon --start --quiet --exec /usr/sbin/updateclnt

	eend $?
}

stop() {
	ebegin "Stopping coda-update"

	if we_are_scm ; then
		start-stop-daemon --stop --quiet --exec /usr/sbin/rpc2portmap
		start-stop-daemon --stop --quiet --exec /usr/sbin/updatesrv
	fi

	start-stop-daemon --stop --quiet --exec /usr/sbin/updateclnt

	eend $?
}