From e9ee00c635b387f3eb575c13cedbcfaf834d6724 Mon Sep 17 00:00:00 2001 From: liuyujielol <2073201758GD@gmail.com> Date: Fri, 27 Dec 2024 18:53:58 +0800 Subject: [PATCH] games-server/vintagestory-server: new package, add 1.19.8, 1.20.0_rc6 Signed-off-by: liuyujielol <2073201758GD@gmail.com> --- acct-group/vintagestory/vintagestory-0.ebuild | 9 +++ acct-user/vintagestory/vintagestory-0.ebuild | 13 ++++ games-server/vintagestory-server/Manifest | 2 + .../files/vintagestory-server.confd | 7 +++ .../files/vintagestory-server.initd | 47 +++++++++++++++ .../files/vintagestory-server.service | 15 +++++ .../vintagestory-server-1.19.8.ebuild | 60 +++++++++++++++++++ .../vintagestory-server-1.20.0_rc6.ebuild | 60 +++++++++++++++++++ 8 files changed, 213 insertions(+) create mode 100644 acct-group/vintagestory/vintagestory-0.ebuild create mode 100644 acct-user/vintagestory/vintagestory-0.ebuild create mode 100644 games-server/vintagestory-server/Manifest create mode 100644 games-server/vintagestory-server/files/vintagestory-server.confd create mode 100644 games-server/vintagestory-server/files/vintagestory-server.initd create mode 100644 games-server/vintagestory-server/files/vintagestory-server.service create mode 100644 games-server/vintagestory-server/vintagestory-server-1.19.8.ebuild create mode 100644 games-server/vintagestory-server/vintagestory-server-1.20.0_rc6.ebuild diff --git a/acct-group/vintagestory/vintagestory-0.ebuild b/acct-group/vintagestory/vintagestory-0.ebuild new file mode 100644 index 00000000000..e6e271e8474 --- /dev/null +++ b/acct-group/vintagestory/vintagestory-0.ebuild @@ -0,0 +1,9 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-group + +DESCRIPTION="User group for Vintage Story Server" +ACCT_GROUP_ID=-1 diff --git a/acct-user/vintagestory/vintagestory-0.ebuild b/acct-user/vintagestory/vintagestory-0.ebuild new file mode 100644 index 00000000000..8eae330f917 --- /dev/null +++ b/acct-user/vintagestory/vintagestory-0.ebuild @@ -0,0 +1,13 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-user + +DESCRIPTION="User for Vintage Story Server" +ACCT_USER_ID=-1 +#ACCT_USER_HOME=/var/lib/vintagestory/home +ACCT_USER_GROUPS=( vintagestory ) + +acct-user_add_deps diff --git a/games-server/vintagestory-server/Manifest b/games-server/vintagestory-server/Manifest new file mode 100644 index 00000000000..5fe3033ff87 --- /dev/null +++ b/games-server/vintagestory-server/Manifest @@ -0,0 +1,2 @@ +DIST vs_server_linux-x64_1.19.8.tar.gz 32058681 BLAKE2B 4b2fa4e28a105a62976b272d878e5ad94e6166826f5ef8f77d479f253a1afef810ac7020d412988c4da3d95c48bbf4662185c1bee6b2042b1ab6181f18395b3e SHA512 dd4193c96416e4c460bd7a42d3a5efb2d2a96c19e71b4ac4a3d1c6954f04b5ffa15493afb8cefc206d4160bf31684bc93cbf3ec22285dcd617f69e27da825f64 +DIST vs_server_linux-x64_1.20.0-rc.6.tar.gz 41266292 BLAKE2B 10097387eeacf2ab9e2a67c9c7c035a133da505be7d58118121c71c57e61905a60bebb0e8e476004524310ce1a177fe3b72998aab9fa475394d26bbf85383754 SHA512 3047b07743598a55fdd66353ef7bd30aa3204a7c7cfbe6c4baa145d1bcaf6311b86f4cb26a3dad40962cb21a1fd5fdc52269ba02407c8e1558f7031d2d38a51a diff --git a/games-server/vintagestory-server/files/vintagestory-server.confd b/games-server/vintagestory-server/files/vintagestory-server.confd new file mode 100644 index 00000000000..25f5d4a840a --- /dev/null +++ b/games-server/vintagestory-server/files/vintagestory-server.confd @@ -0,0 +1,7 @@ +# Copyright 2024 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 redraw is done, +# when you want to detach from the attached console. +DTACH_OPTS="-e '^D' -r none" diff --git a/games-server/vintagestory-server/files/vintagestory-server.initd b/games-server/vintagestory-server/files/vintagestory-server.initd new file mode 100644 index 00000000000..7ce5c456597 --- /dev/null +++ b/games-server/vintagestory-server/files/vintagestory-server.initd @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +if [ "${SVCNAME}" = "vintagestory-server-${PV}" ]; then + instance="main" +else + instance="${SVCNAME#*.}" +fi + +vs_command="/usr/bin/vintagestory-server-${PV}" +vs_path="/opt/vintagestory-server-${PV}" +vs_path_data="/var/lib/vintagestory-server/${PV}" +vs_path_instance="${vs_path_data}/${instance}" +directory="${vs_path_instance}/" +dtach_tmpfile="$(mktemp -u)" +name="Vintage Story ${PV} Server (${instance})" +pidfile="/run/vintagestory-server-${PV}.${instance}.pid" + +description_attach="Attaches to the session (interactive console) of the Vintage Story ${PV} Server (${instance})" +extra_started_commands="attach" + +command="/usr/bin/dtach" +command_background="true" +command_args="-N ${dtach_tmpfile} ${vs_command} --dataPath ${vs_path_instance}" +command_group="vintagestory" +command_user="vintagestory" + +depend() { + use net +} + +start_pre() { + checkpath -d -o "${command_user}:${command_group}" -q "${vs_path_data}" "${vs_path_instance}" +} + +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/vintagestory-server/files/vintagestory-server.service b/games-server/vintagestory-server/files/vintagestory-server.service new file mode 100644 index 00000000000..3a831f5914b --- /dev/null +++ b/games-server/vintagestory-server/files/vintagestory-server.service @@ -0,0 +1,15 @@ +[Unit] +Description=Vintage Story ${PV} Server (World: %I) +After=network.target + +[Service] +User=vintagestory +Group=vintagestory +WorkingDirectory=-/var/lib/vintagestory-server/${PV}/%I +PIDFile=/run/vintagestory-server-${PV}.%I.pid +ExecStartPre=!/bin/mkdir -p /var/lib/vintagestory-server/${PV}/%I +ExecStartPre=!/bin/chown -R vintagestory:vintagestory /var/lib/vintagestory-server/${PV}/%I +ExecStart=/bin/sh -c '/usr/bin/dtach -N $(mktemp -u) /usr/bin/vintagestory-server-${PV} --dataPath /var/lib/vintagestory-server/${PV}/%I' + +[Install] +WantedBy=multi-user.target diff --git a/games-server/vintagestory-server/vintagestory-server-1.19.8.ebuild b/games-server/vintagestory-server/vintagestory-server-1.19.8.ebuild new file mode 100644 index 00000000000..d3e3ed05d02 --- /dev/null +++ b/games-server/vintagestory-server/vintagestory-server-1.19.8.ebuild @@ -0,0 +1,60 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +DOTNET_PKG_COMPAT=7.0 +inherit dotnet-pkg-base systemd + +MY_PV="${PV/_rc/-rc.}" +_CHANNEL="stable" + +DESCRIPTION="Dedicated game server for Vintage Story" +HOMEPAGE="https://www.vintagestory.at/" +SRC_URI="https://cdn.vintagestory.at/gamefiles/${_CHANNEL}/vs_server_linux-x64_${MY_PV}.tar.gz" +S="${WORKDIR}" + +LICENSE="all-rights-reserved" +SLOT="${PV}" +KEYWORDS="-* ~amd64" + +RDEPEND=" + acct-group/vintagestory + acct-user/vintagestory + app-misc/dtach + net-misc/curl + virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} +" +BDEPEND=" + virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} +" + +# Do NOT Distribute! +RESTRICT="bindist mirror strip" + +QA_PREBUILT="*" +QA_PRESTRIPPED="*" + +DOTNET_PKG_OUTPUT="${S}" +INST_DIR="/opt/${PN}-${PV}" + +src_prepare() { + rm "${S}/server.sh" || die + + envsubst < "${FILESDIR}/vintagestory-server.service" > "${S}/vintagestory-server-${PV}@.service" || die + envsubst < "${FILESDIR}/vintagestory-server.initd" > "${S}/vintagestory-server-${PV}.initd" || die + + default +} + +src_compile() { + : +} + +src_install() { + dotnet-pkg-base_install "${INST_DIR}" + dotnet-pkg-base_dolauncher "${INST_DIR}/VintagestoryServer" "${P}" + + newinitd "${S}/vintagestory-server-${PV}.initd" "vintagestory-server-${PV}" + newconfd "${FILESDIR}"/vintagestory-server.confd "vintagestory-server-${PV}" + systemd_dounit "${S}/vintagestory-server-${PV}@.service" +} diff --git a/games-server/vintagestory-server/vintagestory-server-1.20.0_rc6.ebuild b/games-server/vintagestory-server/vintagestory-server-1.20.0_rc6.ebuild new file mode 100644 index 00000000000..1fa40fec50c --- /dev/null +++ b/games-server/vintagestory-server/vintagestory-server-1.20.0_rc6.ebuild @@ -0,0 +1,60 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +DOTNET_PKG_COMPAT=7.0 +inherit dotnet-pkg-base systemd + +MY_PV="${PV/_rc/-rc.}" +_CHANNEL="unstable" + +DESCRIPTION="Dedicated game server for Vintage Story" +HOMEPAGE="https://www.vintagestory.at/" +SRC_URI="https://cdn.vintagestory.at/gamefiles/${_CHANNEL}/vs_server_linux-x64_${MY_PV}.tar.gz" +S="${WORKDIR}" + +LICENSE="all-rights-reserved" +SLOT="${PV}" +KEYWORDS="-* ~amd64" + +RDEPEND=" + acct-group/vintagestory + acct-user/vintagestory + app-misc/dtach + net-misc/curl + virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} +" +BDEPEND=" + virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} +" + +# Do NOT Distribute! +RESTRICT="bindist mirror strip" + +QA_PREBUILT="*" +QA_PRESTRIPPED="*" + +DOTNET_PKG_OUTPUT="${S}" +INST_DIR="/opt/${PN}-${PV}" + +src_prepare() { + rm "${S}/server.sh" || die + + envsubst < "${FILESDIR}/vintagestory-server.service" > "${S}/vintagestory-server-${PV}@.service" || die + envsubst < "${FILESDIR}/vintagestory-server.initd" > "${S}/vintagestory-server-${PV}.initd" || die + + default +} + +src_compile() { + : +} + +src_install() { + dotnet-pkg-base_install "${INST_DIR}" + dotnet-pkg-base_dolauncher "${INST_DIR}/VintagestoryServer" "${P}" + + newinitd "${S}/vintagestory-server-${PV}.initd" "vintagestory-server-${PV}" + newconfd "${FILESDIR}"/vintagestory-server.confd "vintagestory-server-${PV}" + systemd_dounit "${S}/vintagestory-server-${PV}@.service" +}