#!/sbin/openrc-run

description="Dis4IRC daemon"

command="dis4irc"
command_args="--config ${DIS4IRC_CONFIGFILE:-'/etc/dis4irc/config.hocon'}"
error_log=/var/log/dis4irc.log
pidfile="/run/$RC_SVCNAME.pid"
command_background=true

depend() {
	need net
}

start_pre() {
	checkpath -d -m 0700 -o ${command_user}:${command_group} "$(dirname "${DIS4IRC_CONFIGFILE:-/etc/dis4irc/config.hocon}")"
	checkpath -f -m 0600 -o ${command_user}:${command_group} "${DIS4IRC_CONFIGFILE:-/etc/dis4irc/config.hocon}"
	checkpath -f -o ${command_user}:${command_group} "$error_log"
}
