Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Last active August 30, 2018 11:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e-minguez/302e59877e8fe91f6c3db685b500b181 to your computer and use it in GitHub Desktop.
Save e-minguez/302e59877e8fe91f6c3db685b500b181 to your computer and use it in GitHub Desktop.
OpenBSD chocolate-doom server how to

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment