2026-08-10 13:56:40 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
2026-08-11 10:37:03 -04:00
|
|
|
if [[ $# -ne 3 ]]; then
|
|
|
|
|
echo "Usage: $0 /path/to/server-linux-x86_64 GAME_VERSION GAME_COMMIT" >&2
|
2026-08-10 13:56:40 -04:00
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
source_dir="${1%/}"
|
2026-08-11 10:37:03 -04:00
|
|
|
game_version="$2"
|
|
|
|
|
game_commit="${3,,}"
|
2026-08-10 13:56:40 -04:00
|
|
|
repository_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
|
destination_dir="${repository_dir}/dist"
|
2026-08-12 10:11:20 -04:00
|
|
|
licenses_dir="${destination_dir}/licenses"
|
2026-08-11 20:31:02 -04:00
|
|
|
packaging_commit="$(git -C "${repository_dir}" rev-parse HEAD)"
|
|
|
|
|
|
|
|
|
|
if ! git -C "${repository_dir}" diff --quiet \
|
|
|
|
|
|| ! git -C "${repository_dir}" diff --cached --quiet; then
|
|
|
|
|
echo "Commit dedicated packaging changes before staging a release." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-08-10 13:56:40 -04:00
|
|
|
|
2026-08-11 10:37:03 -04:00
|
|
|
if [[ ! "${game_version}" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
|
|
|
|
|
echo "GAME_VERSION must contain only letters, numbers, dots, underscores, or hyphens." >&2
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
if [[ ! "${game_commit}" =~ ^[0-9a-f]{40}$ ]]; then
|
|
|
|
|
echo "GAME_COMMIT must be the full 40-character Git commit." >&2
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
2026-08-11 20:31:02 -04:00
|
|
|
if [[ ! "${packaging_commit}" =~ ^[0-9a-f]{40}$ ]]; then
|
|
|
|
|
echo "Could not resolve the dedicated packaging Git commit." >&2
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
2026-08-11 10:37:03 -04:00
|
|
|
|
2026-08-10 13:56:40 -04:00
|
|
|
for filename in NETfishingServer.x86_64 NETfishingServer.pck; do
|
|
|
|
|
if [[ ! -f "${source_dir}/${filename}" ]]; then
|
|
|
|
|
echo "Missing ${source_dir}/${filename}" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
install -m 0755 "${source_dir}/NETfishingServer.x86_64" \
|
|
|
|
|
"${destination_dir}/NETfishingServer.x86_64"
|
|
|
|
|
install -m 0644 "${source_dir}/NETfishingServer.pck" \
|
|
|
|
|
"${destination_dir}/NETfishingServer.pck"
|
2026-08-12 10:11:20 -04:00
|
|
|
rm -rf -- "${licenses_dir}"
|
|
|
|
|
install -d -m 0755 "${licenses_dir}"
|
|
|
|
|
install -m 0644 "${repository_dir}/LICENSE" \
|
|
|
|
|
"${licenses_dir}/GPL-3.0-or-later.txt"
|
|
|
|
|
install -m 0644 "${repository_dir}/ASSET-LICENSE.md" \
|
|
|
|
|
"${licenses_dir}/ASSET-LICENSE.md"
|
|
|
|
|
install -m 0644 "${repository_dir}/THIRD-PARTY-NOTICES.md" \
|
|
|
|
|
"${licenses_dir}/THIRD-PARTY-NOTICES.md"
|
|
|
|
|
install -m 0644 "${repository_dir}/TRADEMARKS.md" \
|
|
|
|
|
"${licenses_dir}/TRADEMARKS.md"
|
|
|
|
|
install -m 0644 "${repository_dir}/CREDITS.md" \
|
|
|
|
|
"${licenses_dir}/CREDITS.md"
|
2026-08-10 13:56:40 -04:00
|
|
|
|
|
|
|
|
cd -- "${destination_dir}"
|
2026-08-11 10:37:03 -04:00
|
|
|
executable_sha256="$(sha256sum NETfishingServer.x86_64 | awk '{print $1}')"
|
|
|
|
|
pck_sha256="$(sha256sum NETfishingServer.pck | awk '{print $1}')"
|
|
|
|
|
|
|
|
|
|
apply_umask="$(umask)"
|
|
|
|
|
umask 022
|
|
|
|
|
printf '%s\n' \
|
2026-08-11 20:31:02 -04:00
|
|
|
"manifest_version=2" \
|
2026-08-11 10:37:03 -04:00
|
|
|
"game_version=${game_version}" \
|
|
|
|
|
"game_commit=${game_commit}" \
|
2026-08-11 20:31:02 -04:00
|
|
|
"packaging_commit=${packaging_commit}" \
|
2026-08-11 10:37:03 -04:00
|
|
|
"export_preset=Linux Dedicated Server" \
|
|
|
|
|
"platform=linux-x86_64" \
|
|
|
|
|
"executable_sha256=${executable_sha256}" \
|
|
|
|
|
"pck_sha256=${pck_sha256}" \
|
|
|
|
|
> BUILD_INFO
|
2026-08-12 10:11:20 -04:00
|
|
|
cat >SOURCE-CODE.md <<EOF
|
|
|
|
|
# Corresponding source
|
|
|
|
|
|
|
|
|
|
NETfishing dedicated game-server code is licensed under GPL-3.0-or-later.
|
|
|
|
|
|
|
|
|
|
Source repository: https://forge.makearmy.io/woofmeow/netfishing
|
|
|
|
|
Exact game source revision: ${game_commit}
|
|
|
|
|
|
|
|
|
|
Packaging source:
|
|
|
|
|
https://forge.makearmy.io/woofmeow/netfishing-dedicated-server
|
2026-08-12 11:23:46 -04:00
|
|
|
Exact packaging source revision: ${packaging_commit}
|
2026-08-12 10:11:20 -04:00
|
|
|
EOF
|
2026-08-11 10:37:03 -04:00
|
|
|
umask "${apply_umask}"
|
2026-08-12 10:11:20 -04:00
|
|
|
sha256sum \
|
|
|
|
|
NETfishingServer.x86_64 \
|
|
|
|
|
NETfishingServer.pck \
|
|
|
|
|
BUILD_INFO \
|
|
|
|
|
SOURCE-CODE.md \
|
|
|
|
|
licenses/GPL-3.0-or-later.txt \
|
|
|
|
|
licenses/ASSET-LICENSE.md \
|
|
|
|
|
licenses/THIRD-PARTY-NOTICES.md \
|
|
|
|
|
licenses/TRADEMARKS.md \
|
|
|
|
|
licenses/CREDITS.md \
|
|
|
|
|
> SHA256SUMS
|
2026-08-10 13:56:40 -04:00
|
|
|
echo "Staged dedicated server build in ${destination_dir}"
|