From: "Conrad Kostecki" <conikost@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: games-simulation/openttd/, games-simulation/openttd/files/
Date: Tue, 12 Apr 2022 20:59:00 +0000 (UTC) [thread overview]
Message-ID: <1649797105.17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435.conikost@gentoo> (raw)
commit: 17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435
Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 12 20:57:20 2022 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Apr 12 20:58:25 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17d9e666
games-simulation/openttd: add custom attach command
Adding a custom attach command, so you can attach yourself with 'dtach'
in the interactive console open OpenTTD, when running in server mode.
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
games-simulation/openttd/files/openttd.confd | 5 ----
games-simulation/openttd/files/openttd.confd-r1 | 10 +++++++
games-simulation/openttd/files/openttd.initd-r2 | 16 ----------
games-simulation/openttd/files/openttd.initd-r3 | 34 ++++++++++++++++++++++
...{openttd-12.2.ebuild => openttd-12.2-r1.ebuild} | 5 ++--
5 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/games-simulation/openttd/files/openttd.confd b/games-simulation/openttd/files/openttd.confd
deleted file mode 100644
index 399ab5d984c6..000000000000
--- a/games-simulation/openttd/files/openttd.confd
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Options for your started OpenTTD server
-openttd_opts=""
diff --git a/games-simulation/openttd/files/openttd.confd-r1 b/games-simulation/openttd/files/openttd.confd-r1
new file mode 100644
index 000000000000..47cae2fda01a
--- /dev/null
+++ b/games-simulation/openttd/files/openttd.confd-r1
@@ -0,0 +1,10 @@
+# Copyright 1999-2022 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"
+
+# Options for your started OpenTTD server
+openttd_opts=""
diff --git a/games-simulation/openttd/files/openttd.initd-r2 b/games-simulation/openttd/files/openttd.initd-r2
deleted file mode 100644
index 6a24bbc25072..000000000000
--- a/games-simulation/openttd/files/openttd.initd-r2
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2022 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License, v2 or later
-
-description="OpenTTD dedicated game server"
-pidfile="/run/${SVCNAME}.pid"
-
-command="/usr/bin/openttd"
-command_args="-D ${openttd_opts}"
-command_background="true"
-command_group="openttd"
-command_user="openttd"
-
-depend() {
- need net
-}
diff --git a/games-simulation/openttd/files/openttd.initd-r3 b/games-simulation/openttd/files/openttd.initd-r3
new file mode 100644
index 000000000000..89680f91d267
--- /dev/null
+++ b/games-simulation/openttd/files/openttd.initd-r3
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+description="OpenTTD dedicated game server"
+dtach_tmpfile="$(mktemp -u)"
+name="OpenTTD dedicated game server"
+openttd_command="/usr/bin/openttd"
+pidfile="/run/${SVCNAME}.pid"
+
+description_attach="Attaches to the session (interactive console) of the OpenTTD game server"
+extra_started_commands="attach"
+
+command="/usr/bin/dtach"
+command_args="-N ${dtach_tmpfile} ${openttd_command} -D ${openttd_opts}"
+command_background="true"
+command_group="openttd"
+command_user="openttd"
+
+depend() {
+ need net
+}
+
+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-simulation/openttd/openttd-12.2.ebuild b/games-simulation/openttd/openttd-12.2-r1.ebuild
similarity index 96%
rename from games-simulation/openttd/openttd-12.2.ebuild
rename to games-simulation/openttd/openttd-12.2-r1.ebuild
index aaeac2d9a8f2..2c6d18c4b2c4 100644
--- a/games-simulation/openttd/openttd-12.2.ebuild
+++ b/games-simulation/openttd/openttd-12.2-r1.ebuild
@@ -22,6 +22,7 @@ RDEPEND="
dedicated? (
acct-group/openttd
acct-user/openttd
+ app-misc/dtach
)
!dedicated? (
allegro? ( media-libs/allegro:5 )
@@ -90,8 +91,8 @@ src_configure() {
src_install() {
cmake_src_install
if use dedicated ; then
- newconfd "${FILESDIR}"/openttd.confd openttd
- newinitd "${FILESDIR}"/openttd.initd-r2 openttd
+ newconfd "${FILESDIR}"/openttd.confd-r1 openttd
+ newinitd "${FILESDIR}"/openttd.initd-r3 openttd
fi
}
next reply other threads:[~2022-04-12 20:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 20:59 Conrad Kostecki [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-28 12:21 [gentoo-commits] repo/gentoo:master commit in: games-simulation/openttd/, games-simulation/openttd/files/ Sam James
2025-01-28 6:23 Sam James
2024-11-11 7:13 Sam James
2022-04-10 13:24 Conrad Kostecki
2020-11-11 11:22 Lars Wendler
2019-04-03 12:23 Lars Wendler
2019-04-03 12:20 Lars Wendler
2018-09-21 11:37 Lars Wendler
2018-07-16 9:08 Lars Wendler
2017-07-18 23:06 Lars Wendler
2016-04-05 1:03 Michael Sterrett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1649797105.17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435.conikost@gentoo \
--to=conikost@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox