MCPcopy Create free account
hub / github.com/Coooolfan/onlyboxes / prepare_workdir

Function prepare_workdir

scripts/install.py:342–368  ·  view source on GitHub ↗
(workdir: Path, plan: DeploymentPlan)

Source from the content-addressed store, hash-verified

340
341
342def prepare_workdir(workdir: Path, plan: DeploymentPlan) -> None:
343 existing = []
344 for name in ["docker-compose.yml", "db"]:
345 path = workdir / name
346 if path.exists():
347 existing.append(str(path))
348
349 if platform.system() == "Linux":
350 for svc in [CONSOLE_SERVICE_NAME, "onlyboxes-worker-docker", "onlyboxes-worker-boxlite"]:
351 path = Path(f"/etc/systemd/system/{svc}.service")
352 if path.exists():
353 existing.append(str(path))
354
355 if existing:
356 fatal(
357 "workdir",
358 "Existing installation detected. This installer only supports fresh installs.\n"
359 " Found: " + ", ".join(existing),
360 )
361
362 subdirs = ["db", "bin", "install-artifacts"]
363 if plan.worker_runtime == "boxlite":
364 subdirs.append("data/boxlite")
365 for sub in subdirs:
366 (workdir / sub).mkdir(parents=True, exist_ok=True)
367
368 info(f"Working directory ready: {workdir}")
369
370
371def download_and_extract_release(workdir: Path, tag: str, asset_template: str, binary_name: str) -> Path:

Callers 1

mainFunction · 0.85

Calls 2

infoFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected