Keep pre-rebrand dedicated installs compatible
This commit is contained in:
parent
c1b228475d
commit
cd423d0c70
4 changed files with 59 additions and 10 deletions
|
|
@ -12,15 +12,32 @@ fi
|
|||
|
||||
archive_path="$(readlink -f -- "$1")"
|
||||
checksum_input="$2"
|
||||
install_root="${straywild_INSTALL_ROOT:-/opt/straywild-server}"
|
||||
service_name="${straywild_SERVICE_NAME:-straywild-server.service}"
|
||||
if [[ -n "${straywild_INSTALL_ROOT:-}" ]]; then
|
||||
install_root="${straywild_INSTALL_ROOT}"
|
||||
elif [[ -n "${NETFISHING_INSTALL_ROOT:-}" ]]; then
|
||||
install_root="${NETFISHING_INSTALL_ROOT}"
|
||||
elif [[ -d /opt/netfishing-server ]]; then
|
||||
install_root="/opt/netfishing-server"
|
||||
else
|
||||
install_root="/opt/straywild-server"
|
||||
fi
|
||||
if [[ -n "${straywild_SERVICE_NAME:-}" ]]; then
|
||||
service_name="${straywild_SERVICE_NAME}"
|
||||
elif [[ -n "${NETFISHING_SERVICE_NAME:-}" ]]; then
|
||||
service_name="${NETFISHING_SERVICE_NAME}"
|
||||
elif command -v systemctl >/dev/null \
|
||||
&& systemctl cat netfishing-server.service >/dev/null 2>&1; then
|
||||
service_name="netfishing-server.service"
|
||||
else
|
||||
service_name="straywild-server.service"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${archive_path}" ]]; then
|
||||
echo "Archive not found: $1" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${install_root}" != /* || "${install_root}" == "/" ]]; then
|
||||
echo "straywild_INSTALL_ROOT must be a specific absolute directory." >&2
|
||||
echo "The install root must be a specific absolute directory." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
|
@ -171,6 +188,12 @@ else
|
|||
release_stage="$(mktemp -d "${releases_dir}/.incoming.XXXXXX")"
|
||||
install -m 0555 "${payload_dir}/straywildServer.x86_64" "${release_stage}/"
|
||||
install -m 0444 "${payload_dir}/straywildServer.pck" "${release_stage}/"
|
||||
# Old units can keep running while an operator schedules a deliberate
|
||||
# service-name and filesystem migration.
|
||||
install -m 0555 "${payload_dir}/straywildServer.x86_64" \
|
||||
"${release_stage}/NETfishingServer.x86_64"
|
||||
install -m 0444 "${payload_dir}/straywildServer.pck" \
|
||||
"${release_stage}/NETfishingServer.pck"
|
||||
install -m 0444 "${payload_dir}/BUILD_INFO" "${release_stage}/"
|
||||
install -m 0444 "${payload_dir}/SHA256SUMS" "${release_stage}/"
|
||||
install -m 0444 "${payload_dir}/SOURCE-CODE.md" "${release_stage}/"
|
||||
|
|
@ -207,7 +230,8 @@ if command -v systemctl >/dev/null && systemctl cat "${service_name}" >/dev/null
|
|||
if systemctl is-active --quiet "${service_name}"; then
|
||||
service_active=true
|
||||
unit_text="$(systemctl cat "${service_name}")"
|
||||
if [[ "${unit_text}" != *"${install_root}/current/straywildServer.x86_64"* ]]; then
|
||||
if [[ "${unit_text}" != *"${install_root}/current/straywildServer.x86_64"* \
|
||||
&& "${unit_text}" != *"${install_root}/current/NETfishingServer.x86_64"* ]]; then
|
||||
echo "Active ${service_name} does not use the current-release symlink." >&2
|
||||
echo "Migrate the unit while stopped before using this updater." >&2
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -10,12 +10,29 @@ if [[ ${EUID} -ne 0 ]]; then
|
|||
exit 2
|
||||
fi
|
||||
|
||||
install_root="${straywild_INSTALL_ROOT:-/opt/straywild-server}"
|
||||
service_name="${straywild_SERVICE_NAME:-straywild-server.service}"
|
||||
if [[ -n "${straywild_INSTALL_ROOT:-}" ]]; then
|
||||
install_root="${straywild_INSTALL_ROOT}"
|
||||
elif [[ -n "${NETFISHING_INSTALL_ROOT:-}" ]]; then
|
||||
install_root="${NETFISHING_INSTALL_ROOT}"
|
||||
elif [[ -d /opt/netfishing-server ]]; then
|
||||
install_root="/opt/netfishing-server"
|
||||
else
|
||||
install_root="/opt/straywild-server"
|
||||
fi
|
||||
if [[ -n "${straywild_SERVICE_NAME:-}" ]]; then
|
||||
service_name="${straywild_SERVICE_NAME}"
|
||||
elif [[ -n "${NETFISHING_SERVICE_NAME:-}" ]]; then
|
||||
service_name="${NETFISHING_SERVICE_NAME}"
|
||||
elif command -v systemctl >/dev/null \
|
||||
&& systemctl cat netfishing-server.service >/dev/null 2>&1; then
|
||||
service_name="netfishing-server.service"
|
||||
else
|
||||
service_name="straywild-server.service"
|
||||
fi
|
||||
releases_dir="${install_root}/releases"
|
||||
|
||||
if [[ "${install_root}" != /* || "${install_root}" == "/" ]]; then
|
||||
echo "straywild_INSTALL_ROOT must be a specific absolute directory." >&2
|
||||
echo "The install root must be a specific absolute directory." >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ ! -L "${install_root}/current" || ! -L "${install_root}/previous" ]]; then
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ cat >SOURCE-CODE.md <<EOF
|
|||
|
||||
straywild dedicated game-server code is licensed under GPL-3.0-or-later.
|
||||
|
||||
Source repository: https://forge.makearmy.io/woofmeow/straywild
|
||||
Source repository: https://forge.makearmy.io/woofmeow/netfishing
|
||||
Exact game source revision: ${game_commit}
|
||||
|
||||
Packaging source:
|
||||
https://forge.makearmy.io/woofmeow/straywild-dedicated-server
|
||||
https://forge.makearmy.io/woofmeow/netfishing-dedicated-server
|
||||
Exact packaging source revision: ${packaging_commit}
|
||||
EOF
|
||||
umask "${apply_umask}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue