First, install chocolate doom:
doas pkg_add chocolate-doom
Create a group and a user to run the chocolate-server
doas groupadd -g 780 _chocolatedoom
doas useradd -d /nonexistent -g 780 -L daemon -s /sbin/nologin -c "Chocolate Doom Daemon" -u 780 _chocolatedoom
Create the /etc/rc.d/chocolateserver file with the following content
#!/bin/ksh
#
# $OpenBSD: chocolateserver,v 1.0 2018/06/19 19:52:12 rpe Exp $
daemon="/usr/local/bin/chocolate-server"
daemon_flags=
daemon_user="_chocolatedoom"
. /etc/rc.d/rc.subr
pexp="${daemon} ${daemon_flags:+ ${daemon_flags}}"
rc_bg=YES
rc_usercheck=YES
rc_start() {
${rcexec} "${daemon} ${daemon_flags}"
}
rc_check() {
pgrep -q chocolate-server
}
rc_stop() {
pkill chocolate-server
}
rc_cmd $1
Set permissions:
doas chmod a+x /etc/rc.d/chocolateserver
doas chown root.wheel /etc/rc.d/chocolateserver
Enable the service
doas rcctl set chocolateserver status on
Configure some flags to set the servername in https://master.chocolate-doom.org/
doas rcctl set chocolateserver flags "-servername OpenBSD\ powered\ Chocolate\ DooM\ server"
Run it
doas rcctl start chocolateserver