Skip to content

Commit

Permalink
games-server/vintagestory-server: new package, add 1.19.8, 1.20.0_rc6
Browse files Browse the repository at this point in the history
Signed-off-by: liuyujielol <2073201758GD@gmail.com>
  • Loading branch information
liuyujielol authored and peeweep committed Dec 27, 2024
1 parent d05de71 commit e9ee00c
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 0 deletions.
9 changes: 9 additions & 0 deletions acct-group/vintagestory/vintagestory-0.ebuild
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions acct-user/vintagestory/vintagestory-0.ebuild
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions games-server/vintagestory-server/Manifest
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
47 changes: 47 additions & 0 deletions games-server/vintagestory-server/files/vintagestory-server.initd
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions games-server/vintagestory-server/files/vintagestory-server.service
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions games-server/vintagestory-server/vintagestory-server-1.19.8.ebuild
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit e9ee00c

Please sign in to comment.