gates / gates (push) Successful in 6m30s
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
16 lines
1.0 KiB
Bash
Executable File
16 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# grun.sh <tool.py> [args...] — run a tool of this folder INSIDE the Tester 1 guest via stdin, with Jellyfin's admin
|
|
# password substituted for __JF_PW__ in the piped copy only (it lives in ~/.felhom-tester1/secrets.json). The guest copy is deleted.
|
|
cd "$(dirname "$0")"
|
|
python3 - "$@" <<'PY' | sed -E 's/X-Plex-Token=[A-Za-z0-9_-]+/X-Plex-Token=<redacted>/g'
|
|
import json,os,sys,shlex
|
|
sys.path.insert(0,"/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
|
|
os.environ.setdefault("SC",os.path.expanduser("~/.felhom-tester1")); os.environ.setdefault("TARGET","tester-1")
|
|
import box_walk as w
|
|
pw=json.load(open(os.path.expanduser("~/.felhom-tester1/secrets.json")))["jellyfin"]["admin"]
|
|
src=open(sys.argv[1]).read().replace("__JF_PW__",pw)
|
|
args=" ".join(shlex.quote(a) for a in sys.argv[2:])
|
|
r=w.sh(w.ssh_args()+[f'pct exec 9201 -- sh -c "cat > /root/.g.py; timeout 900 python3 /root/.g.py {args} 2>&1; rm -f /root/.g.py"'],timeout=960,inp=src)
|
|
print(r.stdout, end=""); print(r.stderr[-600:]) if r.returncode else None
|
|
PY
|