Source licenses, attribution, provenance, and font notices from the pinned game checkout while retaining installer compatibility with earlier manifest formats.
119 lines
3.9 KiB
Bash
Executable file
119 lines
3.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ $# -ne 4 ]]; then
|
|
echo "Usage: $0 /path/to/server-linux-x86_64 GAME_VERSION GAME_COMMIT /path/to/netfishing" >&2
|
|
exit 2
|
|
fi
|
|
|
|
source_dir="${1%/}"
|
|
game_version="$2"
|
|
game_commit="${3,,}"
|
|
game_repository="${4%/}"
|
|
repository_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
destination_dir="${repository_dir}/dist"
|
|
licenses_dir="${destination_dir}/licenses"
|
|
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
|
|
|
|
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
|
|
if [[ ! -f "${game_repository}/project.godot" ]]; then
|
|
echo "The NETfishing game repository was not found: ${game_repository}" >&2
|
|
exit 2
|
|
fi
|
|
resolved_game_commit="$(git -C "${game_repository}" rev-parse HEAD)"
|
|
if [[ "${resolved_game_commit}" != "${game_commit}" ]]; then
|
|
echo "The NETfishing repository HEAD does not match GAME_COMMIT." >&2
|
|
exit 2
|
|
fi
|
|
if ! git -C "${game_repository}" diff --quiet \
|
|
|| ! git -C "${game_repository}" diff --cached --quiet; then
|
|
echo "The NETfishing repository must be clean before staging notices." >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! "${packaging_commit}" =~ ^[0-9a-f]{40}$ ]]; then
|
|
echo "Could not resolve the dedicated packaging Git commit." >&2
|
|
exit 2
|
|
fi
|
|
|
|
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 -d -m 0755 "${destination_dir}"
|
|
install -m 0755 "${source_dir}/NETfishingServer.x86_64" \
|
|
"${destination_dir}/NETfishingServer.x86_64"
|
|
install -m 0644 "${source_dir}/NETfishingServer.pck" \
|
|
"${destination_dir}/NETfishingServer.pck"
|
|
rm -rf -- "${licenses_dir}"
|
|
install -d -m 0755 "${licenses_dir}"
|
|
install -m 0644 "${game_repository}/LICENSE" \
|
|
"${licenses_dir}/GPL-3.0-or-later.txt"
|
|
install -m 0644 "${game_repository}/ASSET-LICENSE.md" \
|
|
"${licenses_dir}/ASSET-LICENSE.md"
|
|
install -m 0644 "${game_repository}/docs/ATTRIBUTION.md" \
|
|
"${licenses_dir}/ATTRIBUTION.md"
|
|
install -m 0644 "${game_repository}/TRADEMARKS.md" \
|
|
"${licenses_dir}/TRADEMARKS.md"
|
|
install -m 0644 "${game_repository}/ui/fonts/Tuffy-LICENSE.txt" \
|
|
"${licenses_dir}/Tuffy-LICENSE.txt"
|
|
install -m 0644 "${game_repository}/ui/fonts/Seattle-Avenue-LICENSE.txt" \
|
|
"${licenses_dir}/Seattle-Avenue-LICENSE.txt"
|
|
|
|
cd -- "${destination_dir}"
|
|
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' \
|
|
"manifest_version=3" \
|
|
"game_version=${game_version}" \
|
|
"game_commit=${game_commit}" \
|
|
"packaging_commit=${packaging_commit}" \
|
|
"export_preset=Linux Dedicated Server" \
|
|
"platform=linux-x86_64" \
|
|
"executable_sha256=${executable_sha256}" \
|
|
"pck_sha256=${pck_sha256}" \
|
|
> BUILD_INFO
|
|
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
|
|
Exact packaging source revision: ${packaging_commit}
|
|
EOF
|
|
umask "${apply_umask}"
|
|
sha256sum \
|
|
NETfishingServer.x86_64 \
|
|
NETfishingServer.pck \
|
|
BUILD_INFO \
|
|
SOURCE-CODE.md \
|
|
licenses/GPL-3.0-or-later.txt \
|
|
licenses/ASSET-LICENSE.md \
|
|
licenses/ATTRIBUTION.md \
|
|
licenses/TRADEMARKS.md \
|
|
licenses/Tuffy-LICENSE.txt \
|
|
licenses/Seattle-Avenue-LICENSE.txt \
|
|
> SHA256SUMS
|
|
echo "Staged dedicated server build in ${destination_dir}"
|