Skip to content

Commit

Permalink
games/qwfwd: New port: QuakeWorld proxy
Browse files Browse the repository at this point in the history
QWFWD is a QuakeWorld proxy.
Typically used to improve routing to the server, namely to reduce ping.
https://github.com/QW-Group/qwfwd
  • Loading branch information
VVD committed Feb 20, 2025
1 parent 6e78e95 commit 7daf8a7
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GIDs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ openbao:*:482:
rustypaste:*:498:
# free: 499
# free: 500
# free: 501
qwfwd:*:501:
birdvty:*:502:
# free: 503
# free: 504
Expand Down
2 changes: 1 addition & 1 deletion UIDs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ openbao:*:482:482:daemon:0:0:OpenBao Daemon:/nonexistent:/usr/sbin/nologin
rustypaste:*:498:498::0:0:Minimal file upload/pastebin service:/nonexistent:/usr/sbin/nologin
# free: 499
# free: 500
# free: 501
qwfwd:*:501:501::0:0:QuakeWorld Proxy:/nonexistent:/usr/sbin/nologin
# free: 502
# free: 503
# free: 504
Expand Down
1 change: 1 addition & 0 deletions games/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@
SUBDIR += quetoo
SUBDIR += quit
SUBDIR += qwdtools
SUBDIR += qwfwd
SUBDIR += r1q2
SUBDIR += railroad-rampage
SUBDIR += rawgl
Expand Down
41 changes: 41 additions & 0 deletions games/qwfwd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PORTNAME= qwfwd
DISTVERSION= 1.2.20240216
CATEGORIES= games

MAINTAINER= [email protected]
COMMENT= QuakeWorld proxy
WWW= https://github.com/QW-Group/qwfwd/

LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE.md

USES= cmake

USE_GITHUB= yes
GH_ACCOUNT= QW-Group
GH_TAGNAME= f657ff7
USE_RC_SUBR= ${PORTNAME}

EXTRACT_AFTER_ARGS= --exclude .git* \
--exclude */.git* \
--exclude build_cmake.sh \
--exclude tools*

SUB_LIST= QWUSER=${USERS}
USERS= qwfwd
GROUPS= qwfwd
PORTDOCS= README.md

OPTIONS_DEFINE= DOCS

do-install:
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} ${WRKSRC}/resources/example-configs/${PORTNAME}.cfg \
${STAGEDIR}${ETCDIR}/${PORTNAME}.cfg.sample

do-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions games/qwfwd/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1739926256
SHA256 (QW-Group-qwfwd-1.2.20240216-f657ff7_GH0.tar.gz) = 8052eb5b756574c580a49d30502cb31397324dd4bdce7979534ec34478055385
SIZE (QW-Group-qwfwd-1.2.20240216-f657ff7_GH0.tar.gz) = 55473
106 changes: 106 additions & 0 deletions games/qwfwd/files/qwfwd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/sh

# PROVIDE: qwfwd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local to
# enable qwfwd:
# qwfwd_(instance_)?enable (bool): Set to "NO" by default.
# Set it to "YES" to enable qwfwd.
# qwfwd_(instance_)?args (str): Custom additional arguments to be passed
# to ${__qwfwd} (default empty).
# qwfwd_(instance_)?user (str): User to run ${__qwserver} as. Default
# to "%%QWUSER%%" created by the port.
# qwfwd_(instance_)?log (path): Console log file (default
# /var/log/${name}_(instance)?.log).
# qwfwd_(instance_)?configdir (path): Path to config file qwfwd.cfg
# (default "%%ETCDIR%%").
# qwfwd_instances (str): Set to "" by default.
# If defined, list of instances to enable.

. /etc/rc.subr

case $0 in
/etc/rc*)
# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
# so get the name of the script from $_file
name=$_file
;;
*)
name=$0
;;
esac

name=${name##*/}
rcvar="${name}_enable"

load_rc_config "${name}"

eval "${rcvar}=\${${rcvar}:-'NO'}"
eval "__args=\${${name}_args:-''}"
eval "__user=\${${name}_user:-'%%QWUSER%%'}"
eval "__log=\${${name}_log:-/var/log/${name}.log}"
eval "__configdir=\${${name}_configdir:-'%%ETCDIR%%'}"
eval "${name}_chdir=${__configdir}"
eval "__instances=\${${name}_instances:-''}"

pidfiledir="/var/run"
pidfile="${pidfiledir}/${name}.pid"

if [ -n "$2" ]; then
instance="$2"
load_rc_config ${name}_${instance}
case "${__instances}" in
"$2 "*|*" $2 "*|*" $2"|"$2")
eval "__args=\${${name}_${instance}_args:-${__args}}"
eval "__user=\${${name}_${instance}_user:-${__user}}"
eval "__log=\${${name}_${instance}_log:-/var/log/${name}_${instance}.log}"
eval "__configdir=\${${name}_${instance}_configdir:-${__configdir}}"
eval "${name}_chdir=${__configdir}"
pidfile="${pidfiledir}/${name}_${instance}.pid"
;;
*)
err 1 "$2 not found in ${name}_instances" ;;
esac
else
if [ -n "${__instances}" -a -n "$1" ]; then
for instance in ${__instances}; do
eval "_enable=\${${name}_${instance}_enable}"
eval "__enable=\${_enable:-\${${name}_enable}}"
case "${__enable}" in
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
continue
;;
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
;;
*)
if [ -z "${_enable}" ]; then
_var=${name}_enable
else
_var=${name}_${instance}_enable
fi
warn "Bad value '${__enable}' for ${_var}. " \
"Instance ${instance} skipped."
continue
;;
esac
echo "===> ${name} instance: ${instance}"
%%PREFIX%%/etc/rc.d/${name} $1 ${instance}
retcode="$?"
if [ "0${retcode}" -eq 0 ]; then
success="${instance} ${success}"
else
failed="${instance} (retcode=${retcode}) ${failed}"
fi
done
echo "===> ${name} instances success: ${success}"
echo "===> ${name} instances failed: ${failed}"
exit 0
fi
fi

command="/usr/sbin/daemon"
command_args="-P ${pidfile} -u ${__user} -R 5 -f -H -o ${__log} -m 3 %%PREFIX%%/bin/qwfwd ${__args}"

run_rc_command "$1"
2 changes: 2 additions & 0 deletions games/qwfwd/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
QWFWD is a QuakeWorld proxy.
Typically used to improve routing to the server, namely to reduce ping.
2 changes: 2 additions & 0 deletions games/qwfwd/pkg-plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/qwfwd
@sample %%ETCDIR%%/qwfwd.cfg.sample

0 comments on commit 7daf8a7

Please sign in to comment.