mirror of
https://github.com/spoopyghosty0/frameport.git
synced 2026-10-06 13:00:36 +02:00
Setup without root or password: bootstrap.sh turns Developer Mode on itself (Valve's steamos-devkit-mode helper, config.vdf set with Steam stopped) and finishes as a user unit, since Desktop Mode is a nested Plasma inside steam.service (stopping Steam ends it; systemd-run needs the real user bus). Shorter setup command (curl -fsS <ip>:8765/<code> | bash). Valve's devkit pairing (POST :32000/register, ssh-rsa key, Settings → Developer → Pair new host) as a fallback that needs no connection into the PC. Firewall handling: temporary Hyper-V rule on WSL (one UAC prompt, removed after setup), per-OS hints when nothing reaches the setup server. Flet updates serialized (a dialog shown during a scan redraw never closed). Setup command survives page redraws. Uninstall: removes Lepton's overlayfs work dirs (mode 000) and stale shortcuts (agent v31). Tests no longer touch the real data folder. README: highlights, what the setup changes on the Frame, network and firewalls.
47 lines
2.0 KiB
Python
47 lines
2.0 KiB
Python
"""bootstrap.sh: valid bash, placeholders for the pairing server, and the config.vdf edit that turns on Developer
|
|
Mode."""
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
from frameport.core.paths import bootstrap_dir
|
|
|
|
SCRIPT = (bootstrap_dir() / "bootstrap.sh").read_text()
|
|
|
|
|
|
def devmode_edit() -> str:
|
|
return re.search(r"python3 - \"\$CONFIG\" <<'PY'[^\n]*\n(.*?)\nPY\n", SCRIPT, re.S).group(1)
|
|
|
|
|
|
@pytest.mark.skipif(shutil.which("bash") is None, reason="needs bash")
|
|
def test_bash_syntax():
|
|
subprocess.run(["bash", "-n"], input=SCRIPT, text=True, check=True)
|
|
|
|
|
|
def test_placeholders_and_steps():
|
|
assert "__PC_URL__" in SCRIPT and "__PAIR_CODE__" in SCRIPT
|
|
assert "steamos-devkit-mode" in SCRIPT and "/etc/steamos-devkit-enabled" in SCRIPT
|
|
assert "sudo" not in SCRIPT.split("set -euo pipefail", 1)[1] and "passwd" not in SCRIPT # no password, ever
|
|
# Desktop Mode is a nested session inside steam.service: the Developer Mode job (it stops Steam) must run as a
|
|
# user unit reached through the real user bus, logging to a file that outlives the terminal
|
|
assert 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"' in SCRIPT
|
|
assert "user_systemd systemd-run --user" in SCRIPT and ".cache/frameport-setup.log" in SCRIPT
|
|
|
|
|
|
@pytest.mark.parametrize("before", [
|
|
'"InstallConfigStore"\n{\n\t"Software"\n\t{\n\t\t"Valve"\n\t\t{\n\t\t}\n\t}\n'
|
|
'\t"developer"\n\t{\n\t\t"Other"\t\t"x"\n\t}\n}\n',
|
|
'"InstallConfigStore"\n{\n\t"Software"\n\t{\n\t}\n}\n',
|
|
'"InstallConfigStore"\n{\n\t"developer"\n\t{\n\t\t"DevModeEnabled"\t\t"0"\n\t}\n}\n',
|
|
])
|
|
def test_devmode_config_edit(tmp_path, before):
|
|
cfg = tmp_path / "config.vdf"
|
|
cfg.write_text(before)
|
|
subprocess.run([sys.executable, "-", str(cfg)], input=devmode_edit(), text=True, check=True)
|
|
after = cfg.read_text()
|
|
assert re.search(r'\t"developer"\n\t\{\n(?:.*\n)*?\t\t"DevModeEnabled"\t\t"1"\n', after)
|
|
assert after.count("DevModeEnabled") == 1 and after.count("{") == after.count("}")
|