aboutsummaryrefslogtreecommitdiffstats
path: root/community/matrix-appservice-irc/matrix-appservice-irc.initd
blob: 2c80daad6b2c4d8ab661ab6349cf8fc1037f0c19 (plain) (blame)
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
#!/sbin/openrc-run
supervisor=supervise-daemon

name="matrix-appservice-irc"
description="Daemon for matrix-appservice-irc, a Node.js IRC bridge for Matrix"

: ${command_user:="synapse:synapse"}
: ${config:="/etc/matrix-appservice-irc/config.yaml"}
: ${registration_file:="/etc/synapse/matrix-appservice-irc-registration.yaml"}
: ${port:=9999}

command="/usr/bin/matrix-appservice-irc"
command_args="-c $config -f $registration_file -p $port"
supervise_daemon_args="--chdir /var/lib/matrix-appservice-irc --stdout /var/log/matrix-appservice-irc.log --stderr /var/log/matrix-appservice-irc.log"

depends() {
	use logger
	need net
}

start_pre() {
	checkpath --owner $command_user --file /var/log/matrix-appservice-irc.log
	if [ ! -f $config ]; then
		eerror "Couldn't find config file!"
		return 1
	fi
	if [ ! -f $registration_file ]; then
		eerror "Couldn't find registration file!
		See https://github.com/matrix-org/matrix-appservice-irc#3-registration for how to generate one."
		return 1
	fi
}