16 lines
1004 B
Bash
Executable File
16 lines
1004 B
Bash
Executable File
#!/bin/bash
|
|
# snaprun.sh <label> — run snap.py in the Tester 1 guest (stdin, no file args) with Jellyfin's password substituted into
|
|
# the piped copy; the guest copy is deleted. Output appended to ../S5-S6/snapshots.txt.
|
|
cd "$(dirname "$0")"
|
|
python3 - "$1" <<'PY' | sed -E 's/X-Plex-Token=[A-Za-z0-9_-]+/X-Plex-Token=<redacted>/g' | tee -a ../S5-S6/snapshots.txt
|
|
import json,os,sys
|
|
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("snap.py").read().replace("__JF_PW__",pw)
|
|
lab=sys.argv[1].replace('"','')
|
|
r=w.sh(w.ssh_args()+[f'pct exec 9201 -- sh -c "cat > /root/.snap.py; timeout 200 python3 /root/.snap.py \'{lab}\' 2>&1; rm -f /root/.snap.py"'],timeout=240,inp=src)
|
|
print(r.stdout); print(r.stderr[-800:]) if r.returncode else None
|
|
PY
|