From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D0B69158003 for ; Tue, 12 Apr 2022 20:59:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A4988E096A; Tue, 12 Apr 2022 20:59:04 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0DD3E096A for ; Tue, 12 Apr 2022 20:59:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E78E2341AD0 for ; Tue, 12 Apr 2022 20:59:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 548702B0 for ; Tue, 12 Apr 2022 20:59:00 +0000 (UTC) From: "Conrad Kostecki" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Conrad Kostecki" Message-ID: <1649797105.17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435.conikost@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: games-simulation/openttd/, games-simulation/openttd/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: games-simulation/openttd/files/openttd.confd games-simulation/openttd/files/openttd.confd-r1 games-simulation/openttd/files/openttd.initd-r2 games-simulation/openttd/files/openttd.initd-r3 games-simulation/openttd/openttd-12.2-r1.ebuild games-simulation/openttd/openttd-12.2.ebuild X-VCS-Directories: games-simulation/openttd/ games-simulation/openttd/files/ X-VCS-Committer: conikost X-VCS-Committer-Name: Conrad Kostecki X-VCS-Revision: 17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435 X-VCS-Branch: master Date: Tue, 12 Apr 2022 20:59:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b266efaa-671d-4b77-adb6-a8013470a614 X-Archives-Hash: c079b2f9de2db69d7116821376e297d1 commit: 17d9e66641cfdec7bf1a2f97f8d50fd4d93d8435 Author: Conrad Kostecki gentoo org> AuthorDate: Tue Apr 12 20:57:20 2022 +0000 Commit: Conrad Kostecki gentoo 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 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 }