diff --git a/bin/restore-linux.sh b/bin/restore-linux.sh index 27407d7..a72c3c9 100644 --- a/bin/restore-linux.sh +++ b/bin/restore-linux.sh @@ -33,9 +33,29 @@ if [ "$stage" = "prep" ]; then # installed, so it's cheap on an in-place restore. Skipped without apt (non-Debian). if command -v apt-get >/dev/null; then echo "Installing system packages..." - sudo apt-get install -y --no-install-recommends \ - git sqlite3 curl python3-venv python3-gi gir1.2-gtk-3.0 \ - xfce4-genmon-plugin plank blueman \ + + # python3-venv is a transitional package pointing at the real + # pythonX.Y-venv for whatever Python ships by default; on a distro ahead + # of that transition it resolves to nothing ("has no installation + # candidate") even though a real, version-suffixed package exists. + # apt-cache show only succeeds for a package with an actual archive + # entry, so it tells the two cases apart without guessing. + venv_pkg="python3-venv" + if command -v python3 >/dev/null && ! apt-cache show python3-venv >/dev/null 2>&1; then + venv_pkg="python3-$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')-venv" + fi + + pkgs="git sqlite3 curl $venv_pkg python3-gi gir1.2-gtk-3.0" + # XFCE-only cosmetics: only worth attempting where there's an XFCE + # session to plug into. Same signal the desktop stage below already + # gates on, so a headless/WSL box (no xfconf-query) isn't left with + # noisy "unable to locate package" failures for a panel it'll never run. + if command -v xfconf-query >/dev/null; then + pkgs="$pkgs xfce4-genmon-plugin plank blueman" + fi + + # shellcheck disable=SC2086 # $pkgs is a deliberate word-split list + sudo apt-get install -y --no-install-recommends $pkgs \ || echo "Warning: some system packages failed — install them manually." # Node.js 20+: Vite needs 20.19+, but Debian/Ubuntu apt ship an EOL Node 18 diff --git a/bin/sync.py b/bin/sync.py index 4f509c2..4438433 100644 --- a/bin/sync.py +++ b/bin/sync.py @@ -62,7 +62,14 @@ def venv_python() -> Path: venv = ROOT / "Promethean" py = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python") if not py.exists(): - subprocess.run([sys.executable, "-m", "venv", str(venv)], check=True) + result = subprocess.run([sys.executable, "-m", "venv", str(venv)]) + if result.returncode: + raise SystemExit( + "\nvenv creation failed - the Python 'venv' module isn't usable here.\n" + "On Debian/Ubuntu this is usually a missing pythonX.Y-venv package; " + "check the 'Installing system packages' warning further up, install " + "it by hand, then re-run." + ) return py