commit: 3f20fce72abfaacfaf99ef38f82509a1e1f4d1b2
Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 17:00:30 2020 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 17:21:47 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f20fce7
games-server/steamcmd: switch to dtach
This version changes the usage from app-misc/screen
to app-misc/dtach. A custom attach command is also
added with that switch.
Since at least the valve game server are running as an
interactive console process in background, this custom
command 'attach' enables the possibility to connect with
dtach to that interactive console and send commands to
the running server.
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
games-server/steamcmd/files/steamcmd.confd-r2 | 20 +++++++++++
games-server/steamcmd/files/steamcmd.initd-r2 | 47 ++++++++++++++++++++++++
games-server/steamcmd/steamcmd-1.0-r3.ebuild | 52 +++++++++++++++++++++++++++
3 files changed, 119 insertions(+)
diff --git a/games-server/steamcmd/files/steamcmd.confd-r2
b/games-server/steamcmd/files/steamcmd.confd-r2
new file mode 100644
index 00000000000..5cd84e169f5
--- /dev/null
+++ b/games-server/steamcmd/files/steamcmd.confd-r2
@@ -0,0 +1,20 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Dtach options, which will used, when the `attach` extra command is called.
+# By default, CTRL+D is used, and no signal is send,
+# when you want to detach from the attached console.
+DTACH_OPTS="-e '^D' -r none"
+
+# Specifies, which server binary is used.
+# This could be 'hlds_run' or 'srcds_run', depending on your game.
+# STEAMCMD_BINARY="hlds_run"
+
+# Path to the files of your started server.
+# It's recommended to use:
+# '/opt/steamcmd/hlds' for older HL1 based mods.
+# '/opt/steamcmd/srcds' for newer HL2 based mods.
+# STEAMCMD_PATH="/opt/steamcmd/hlds"
+
+# Options for your server binary.
+# STEAMCMD_OPTS="-game valve +ip 127.0.0.1 +maxplayers 32 +map crossfire
-pingboost 3"
diff --git a/games-server/steamcmd/files/steamcmd.initd-r2
b/games-server/steamcmd/files/steamcmd.initd-r2
new file mode 100644
index 00000000000..4564d452681
--- /dev/null
+++ b/games-server/steamcmd/files/steamcmd.initd-r2
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+if [ "${SVCNAME}" = "steamcmd" ]; then
+ instance="main"
+else
+ instance="${SVCNAME#steamcmd.}"
+fi
+
+dtach_tmpfile="$(mktemp -u)"
+name="SteamCMD (Mod: ${instance})"
+pidfile="/run/steamcmd.${instance}.pid"
+start_stop_daemon_args="--chdir ${STEAMCMD_PATH}"
+
+description_attach="Attaches to the session (non-interactive console) of the
SteamCMD game server"
+extra_started_commands="attach"
+
+command="/usr/bin/dtach"
+command_args="-N ${dtach_tmpfile} ${STEAMCMD_PATH}/${STEAMCMD_BINARY}
${STEAMCMD_OPTS}"
+command_background="true"
+command_group="steamcmd"
+command_user="steamcmd"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ if [ -z "${STEAMCMD_BINARY}" ] || [ -z "${STEAMCMD_PATH}" ]; then
+ eerror "One or more STEAMCMD_* variables in
/etc/conf.d/${SVCNAME} are not set!"
+ return 1
+ fi
+ return 0
+}
+
+attach() {
+ pidnumber="$(cat ${pidfile})"
+ dtach_tmpfile="$(cat /proc/${pidnumber}/cmdline | tr '\0' ' ' | awk
'{print $3}')"
+
+ if [ -S "${dtach_tmpfile}" ]; then
+ eval "${command}" -a "${dtach_tmpfile}" "${DTACH_OPTS}"
+ else
+ eerror "The determined socket file for dtach could not be
found!"
+ eerror "Did the process crash?"
+ fi
+}
diff --git a/games-server/steamcmd/steamcmd-1.0-r3.ebuild
b/games-server/steamcmd/steamcmd-1.0-r3.ebuild
new file mode 100644
index 00000000000..1c33b66301d
--- /dev/null
+++ b/games-server/steamcmd/steamcmd-1.0-r3.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit readme.gentoo-r1
+
+DESCRIPTION="This is the command-line version of the Steam client for
dedicated servers"
+HOMEPAGE="https://developer.valvesoftware.com/wiki/SteamCMD"
+SRC_URI="https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
-> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1+ Steam"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND="
+ acct-group/steamcmd
+ acct-user/steamcmd
+ app-misc/dtach
+"
+
+RESTRICT="bindist mirror"
+
+S="${WORKDIR}"
+
+QA_PREBUILT="
+ opt/steamcmd/linux32/libstdc++.so.6
+ opt/steamcmd/linux32/steamcmd
+"
+
+src_install() {
+ diropts -o steamcmd -g steamcmd
+ dodir /opt/steamcmd
+ keepdir /opt/steamcmd/{.steam,.steam/sdk32,linux32}
+
+ exeopts -o steamcmd -g steamcmd
+ exeinto /opt/steamcmd
+ doexe steamcmd.sh
+
+ exeopts -o steamcmd -g steamcmd
+ exeinto /opt/steamcmd/linux32
+ doexe linux32/steamcmd linux32/libstdc++.so.6
+
+ newinitd "${FILESDIR}"/steamcmd.initd-r2 steamcmd
+ newconfd "${FILESDIR}"/steamcmd.confd-r2 steamcmd
+
+ readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ readme.gentoo_print_elog
+}