mirror of
https://github.com/knutwurst/patchdl.git
synced 2026-10-06 10:00:22 +02:00
Handle target-aware patch installs
This commit is contained in:
1 parent
01464ae88a
commit
510f199b89
14 files changed
+1010
-234
No files matched your search
+26
-2
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Deploy patchdl to the PS5 via the Payload Manager HTTP API (port 8084).
|
||||
# The uploaded filename carries the version so it is identifiable in the
|
||||
# Payload Manager UI. patchdl self-kills any running instance, so this is
|
||||
# an idempotent redeploy.
|
||||
# Payload Manager UI. Any running instance is killed first (the payload's own
|
||||
# self-kill is racy when the port is still held), so this is a clean redeploy.
|
||||
#
|
||||
# Usage: scripts/deploy_ps5.sh [PS5_HOST]
|
||||
# PS5_HOST defaults to $PS5_HOST or ps5-slim.fritz.box
|
||||
@@ -40,6 +40,30 @@ for p in paths:
|
||||
')
|
||||
[ -n "$PAYLOAD_PATH" ] || { echo "uploaded payload not found in list_payloads" >&2; exit 1; }
|
||||
|
||||
# Kill any running patchdl first so the new instance can bind the port
|
||||
# deterministically (the in-payload self-kill races on the held socket).
|
||||
echo "Stopping any running patchdl ..."
|
||||
curl -fsS -m15 "http://$HOST:$PM_PORT/processes_list" 2>/dev/null | \
|
||||
HOST="$HOST" PM_PORT="$PM_PORT" python3 -c '
|
||||
import os, sys, json, urllib.request
|
||||
obj = json.load(sys.stdin)
|
||||
procs = obj if isinstance(obj, list) else obj.get("processes", [])
|
||||
host, port = os.environ["HOST"], os.environ["PM_PORT"]
|
||||
for p in procs:
|
||||
if "patchdl" in str(p.get("name", "")).lower():
|
||||
try:
|
||||
urllib.request.urlopen("http://%s:%s/process_kill?pid=%d" % (host, port, int(p["pid"])), timeout=10).read()
|
||||
print(" killed pid %d" % int(p["pid"]))
|
||||
except Exception as e:
|
||||
print(" kill pid %s failed: %s" % (p.get("pid"), e))
|
||||
' || true
|
||||
i=0
|
||||
while [ "$i" -lt 8 ]; do
|
||||
curl -fsS -m4 "http://$HOST:$HTTP_PORT/api/status" >/dev/null 2>&1 || break
|
||||
sleep 1
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
echo "Launching $PAYLOAD_PATH ..."
|
||||
curl -fsS -m20 "http://$HOST:$PM_PORT/loadpayload:$PAYLOAD_PATH" >/dev/null
|
||||
|
||||
|
||||
Reference in new issue
Block a user