Fix SCUM SteamCMD lifecycle install

This commit is contained in:
npc0-hue
2026-08-01 14:47:24 +08:00
parent 0e4dbf26aa
commit e37f00c48a
8 changed files with 56 additions and 14 deletions
+23 -3
View File
@@ -92,9 +92,29 @@ local_debug_seed_lifecycle_scope() {
cp "$source_dir/actions/$action.json" "$scope/actions/$action.json"
fi
done
cp "$true_binary" "$scope/bin/install-server"
cp "$true_binary" "$scope/bin/game-server"
chmod +x "$scope/bin/install-server" "$scope/bin/game-server"
local executable_key
while IFS= read -r executable_key; do
[[ -n "$executable_key" ]] || continue
local executable_target="$scope/$executable_key"
mkdir -p "$(dirname "$executable_target")"
cp "$true_binary" "$executable_target"
chmod +x "$executable_target"
done < <(node - "$scope/actions" <<'NODE'
const fs = require("fs");
const path = require("path");
const actionsDir = process.argv[2];
for (const entry of fs.readdirSync(actionsDir)) {
if (!entry.endsWith(".json")) continue;
const action = JSON.parse(fs.readFileSync(path.join(actionsDir, entry), "utf8"));
const key = action.executableKey;
if (typeof key !== "string" || key.length === 0) continue;
if (path.posix.isAbsolute(key) || key.includes("\\") || key.split("/").includes("..")) {
throw new Error(`unsafe local-debug executableKey: ${key}`);
}
console.log(key);
}
NODE
)
}
local_debug_seed_plugin_lifecycle_template() {
+8 -2
View File
@@ -296,14 +296,19 @@ json_id() {
require_scum_manifest_contract() {
local file="$1"
node - "$file" <<'NODE'
local expected_version="$2"
node - "$file" "$expected_version" <<'NODE'
const fs = require("fs");
const file = process.argv[2];
const expectedVersion = process.argv[3];
const plugin = JSON.parse(fs.readFileSync(file, "utf8"));
const missing = [];
const declaredPermissions = Array.isArray(plugin.declaredPermissions) ? plugin.declaredPermissions : [];
const bridgeActions = Array.isArray(plugin.bridgeActions) ? plugin.bridgeActions : [];
const lifecycleProfiles = plugin.runtimeProfiles?.lifecycleProfiles ?? [];
if (plugin.version !== expectedVersion) {
missing.push(`version ${expectedVersion}`);
}
if (!declaredPermissions.includes("server.run.distribution")) {
missing.push("server.run.distribution permission");
}
@@ -781,7 +786,8 @@ NODE
printf 'registering SCUM plugin through platform API\n'
register_plugin_manifest "SCUM plugin" "game.scum" "$WORK_DIR/register-scum-plugin.request.json" "$WORK_DIR/register-scum-plugin.response.json"
reject_forbidden_fragments "$WORK_DIR/register-scum-plugin.response.json"
require_scum_manifest_contract "$WORK_DIR/register-scum-plugin.response.json"
SCUM_PLUGIN_VERSION="$(node -e 'const fs=require("fs"); process.stdout.write(JSON.parse(fs.readFileSync(process.argv[1],"utf8")).version);' "$ROOT_DIR/plugins/examples/scum-server-plugin/manifest.json")"
require_scum_manifest_contract "$WORK_DIR/register-scum-plugin.response.json" "$SCUM_PLUGIN_VERSION"
printf 'waiting for run endpoint heartbeat\n'
for _ in $(seq 1 20); do