summaryrefslogtreecommitdiff
blob: cfdfc41559f63c17e2a2bb542ccb4d3602d4d339 (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
59
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
	need bluetooth
	use logger
}

check_config() {
	if [ -z "${USER}" ] ; then
		eerror "Please set \$USER in /etc/conf.d/sobexsrv!"
		return 1
	fi
	if [ -z "${GROUP}" ] ; then
		eerror "Please set \$GROUP in /etc/conf.d/sobexsrv!"
		return 1
	fi

	if [ ${CHROOT} = "yes" ] ; then
		if [ ! -u /usr/bin/sobexsrv ] ; then
			eerror "The \$CHROOT option requires /usr/bin/sobexsrv to be suid root!"
			return 1
		fi
	fi

	if [ -z "${INBOX}" ] || [ ! -e "${INBOX}" ] ; then
		eerror "Please configure \$INBOX correctly in /etc/conf.d/sobexsrv!"
		return 1
	fi
}


start() {
	check_config || return 1

	ebegin "Starting sobexsrv"

	OPTIONS=""
	[ -n "${CHANNEL}" ] && OPTIONS="${OPTIONS} -c ${CHANNEL}"
	[ -n "${SECURITY_LEVEL}" ] && OPTIONS="${OPTIONS} -s ${SECURITY_LEVEL}"
	[ "${CHROOT}" = "yes" ] && OPTIONS="${OPTIONS} -R"
	[ "${DISABLE_OPUSH}" = "yes" ] && OPTIONS="${OPTIONS} -o"
	[ "${DISABLE_OBEXFTP}" = "yes" ] && OPTIONS="${OPTIONS} -f"
	[ "${DISABLE_OBEXFTP_LISTING}" = "yes" ] && OPTIONS="${OPTIONS} -F"
	[ "${USE_SYSLOG}" = "yes" ] && OPTIONS="${OPTIONS} -S"

	OPTIONS="-I -r ${INBOX} ${OPTIONS} ${SOBEXSRV_OPT}"

	start-stop-daemon --chuid ${USER}:${GROUP} --start --quiet --exec /usr/bin/sobexsrv -- $OPTIONS
	eend $?
}

stop() {
	ebegin "Stopping sobexsrv"
	start-stop-daemon --stop --quiet --exec /usr/bin/sobexsrv
	eend $?
}