summaryrefslogtreecommitdiff
path: root/games/ioquake3/files/ioq3ded.in
blob: 934af3fc29884c9fd5f29ed4b67e5d2b3c5c0f7a (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

# PROVIDE: ioq3ded
# REQUIRE: LOGIN

####
# Add the following line to /etc/rc.conf to enable ioq3ded
#
#  ioq3ded_enable="YES"
#  # optional
#  ioq3ded_args="+set dedicated 1 +set com_hunkmegs 32 +exec server.cfg"
#  ioq3ded_home="/var/run/ioq3ded"
#  ioq3ded_data="%%Q3DIR%%"
#  ioq3ded_user="games"
#  ioq3ded_group="games"
#
# Note:
# This script is set to execute server.cfg from the system baseq3
#  folder at launch.  Most server config can be placed there.
# Some options MUST go on command-line and should be placed in
#  "ioq3ded_args" instead - these include "dedicated",
#  "com_hunkmegs", etc.
####

. /etc/rc.subr

name=ioq3ded
rcvar=ioq3ded_enable

load_rc_config $name

: ${ioq3ded_enable:="NO"}
: ${ioq3ded_args="+set dedicated 1 +set com_hunkmegs 32 +exec server.cfg"}
: ${ioq3ded_home:="/var/run/ioq3ded"}
: ${ioq3ded_data:="%%Q3DIR%%"}
: ${ioq3ded_user:="games"}
: ${ioq3ded_group:="games"}

start_precmd="ioq3ded_precmd"

ioq3ded_precmd()
{
    install -d -o ${ioq3ded_user} -g ${ioq3ded_group} ${ioq3ded_home}
}

pidfile="${ioq3ded_home}/ioq3ded-daemon.pid"
child_pidfile="${ioq3ded_home}/ioq3ded.pid"

command="/usr/sbin/daemon"
command_args="-c -f -P ${pidfile} -p ${child_pidfile} %%PREFIX%%/bin/ioq3ded +set fs_basepath ${ioq3ded_data} +set fs_homepath ${ioq3ded_home} ${ioq3ded_args}"

run_rc_command "$1"