Windows version: host the server from your own PC
setup.cmd installs the same DM/GunGame server natively on Windows 10/11 (no Docker or Python) into Documents\cs16, then helps set up how friends join (LAN, playit.gg, port forwarding, VPN). cs.cmd is the menu. Also: setup falls back to backup copies of the freely licensed mod downloads on this Gitea when a main site is down (tools/make-mirror.sh fills them), and the README is rewritten as a plain guide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7e9cbee14d
commit
4b7fdcaa23
16 files changed
+1412
-72
No files matched your search
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
# For the maintainer: puts backup copies of the freely licensed downloads on the Gitea release
|
||||
# "mods", which setup falls back to when a main site is down (see "#mirror" in versions.txt).
|
||||
# Only MIT / GPL / Unlicense files are mirrored; the rest (CSDM-ReAPI, GunGame, sounds, spawn
|
||||
# files) has no license and stays download-only.
|
||||
# sh tools/make-mirror.sh uses your saved git login for git.userevolt.app
|
||||
# GITEA_TOKEN=<token, repo read+write> sh tools/make-mirror.sh
|
||||
# Needs curl and python3 (or python). Safe to run again: files already on the release are skipped.
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
API=https://git.userevolt.app/api/v1/repos/esef/cs16-dm-server
|
||||
TAG=mods
|
||||
PY=$(command -v python3 || command -v python) || { echo "needs python3"; exit 1; }
|
||||
DIR=$(mktemp -d); trap 'rm -rf "$DIR"' EXIT
|
||||
CFG=$DIR/curl.cfg # credentials go to curl through a file, not the command line
|
||||
umask 077
|
||||
if [ -n "$GITEA_TOKEN" ]; then
|
||||
printf 'header = "Authorization: token %s"\n' "$GITEA_TOKEN" > "$CFG"
|
||||
else
|
||||
cred=$(printf 'protocol=https\nhost=git.userevolt.app\n\n' | GIT_TERMINAL_PROMPT=0 git credential fill 2>/dev/null) ||
|
||||
{ echo "no saved git login for git.userevolt.app: push once, or set GITEA_TOKEN"; exit 1; }
|
||||
u=$(printf '%s\n' "$cred" | sed -n 's/^username=//p')
|
||||
pw=$(printf '%s\n' "$cred" | sed -n 's/^password=//p')
|
||||
printf 'user = "%s:%s"\n' "$u" "$pw" > "$CFG"
|
||||
fi
|
||||
umask 022
|
||||
json() { "$PY" -c "import json,sys; d=json.load(sys.stdin); print($1)"; }
|
||||
curl -fsS -K "$CFG" -o /dev/null https://git.userevolt.app/api/v1/user ||
|
||||
{ echo "Gitea didn't accept the login (wrong or expired?)"; exit 1; }
|
||||
|
||||
echo "== downloading and checking"
|
||||
cat tools/versions.txt tools/versions-windows.txt | tr -d '\r' | grep -v '^#' |
|
||||
grep -E '^(rehlds-bin|regamedll-bin|metamod-bin|amxmodx-|reapi-bin|reunion-|yapb-)' |
|
||||
while read -r f sum url; do
|
||||
curl -fsSL --retry 3 -o "$DIR/$f" "$url"
|
||||
got=$( (sha256sum "$DIR/$f" 2>/dev/null || shasum -a 256 "$DIR/$f") | cut -c1-64)
|
||||
[ "$got" = "$sum" ] || { echo "checksum mismatch for $f"; exit 1; }
|
||||
echo " ok $f"
|
||||
done
|
||||
|
||||
echo "== release '$TAG'"
|
||||
id=$(curl -fsS -K "$CFG" "$API/releases/tags/$TAG" 2>/dev/null | json "d['id']" || true)
|
||||
if [ -z "$id" ]; then
|
||||
body='Backup copies of the mod downloads, used by setup only when a main site is down. Every file is checked against tools/versions.txt before it is installed. Sources and licenses: ReHLDS, ReGameDLL_CS (MIT), Metamod-R, ReAPI, ReUnion (GPL-3.0) at github.com/rehlds; AMX Mod X (GPL-3.0) at github.com/alliedmodders/amxmodx; YaPB (Unlicense) at github.com/yapb/yapb.'
|
||||
id=$(printf '{"tag_name":"%s","target_commitish":"main","name":"Mod downloads (backup copies)","body":"%s"}' "$TAG" "$body" |
|
||||
curl -fsS -K "$CFG" -H 'Content-Type: application/json' -d @- "$API/releases" | json "d['id']")
|
||||
echo " created (id $id)"
|
||||
else
|
||||
echo " exists (id $id)"
|
||||
fi
|
||||
have=$(curl -fsS -K "$CFG" "$API/releases/$id/assets" | json "'\n'.join(a['name'] for a in d)")
|
||||
|
||||
echo "== uploading"
|
||||
for p in "$DIR"/*; do
|
||||
f=$(basename "$p")
|
||||
if printf '%s\n' "$have" | grep -qxF "$f"; then echo " have $f"; continue; fi
|
||||
curl -fsS -K "$CFG" -F "attachment=@$p" "$API/releases/$id/assets?name=$f" > /dev/null
|
||||
echo " up $f"
|
||||
done
|
||||
echo "done: https://git.userevolt.app/esef/cs16-dm-server/releases/tag/$TAG"
|
||||
Reference in new issue
Block a user