Fix Buildroot OTA upgrade path

This commit is contained in:
Yellowcooln
2026-04-29 13:43:13 -04:00
parent 56814bfc38
commit fe0d3d30af
2 changed files with 28 additions and 1 deletions
+17
View File
@@ -622,6 +622,21 @@ PY
info "Linked image-provided Python runtime into the venv"
}
remove_shadowing_buildroot_native_packages() {
local removed=0
if "$VENV_PIP" show python-periphery >/dev/null 2>&1; then
stage "Restoring Buildroot GPIO runtime"
info "Removing venv-installed python-periphery so the image-provided package is used"
"$VENV_PIP" uninstall -y python-periphery >/dev/null 2>&1 || true
removed=1
fi
if [ "$removed" -eq 0 ]; then
info "No shadowing Buildroot native GPIO wheels found in the venv"
fi
}
install_core_into_venv() {
local core_repo core_ref core_spec
@@ -1361,6 +1376,7 @@ install_repeater() {
install_buildroot_dependencies
install_core_into_venv
install_repeater_package
remove_shadowing_buildroot_native_packages
link_system_site_packages
stage "Validating installed runtime"
@@ -1426,6 +1442,7 @@ upgrade_repeater() {
ensure_yq >/dev/null 2>&1 || true
install_repeater_package
fi
remove_shadowing_buildroot_native_packages
link_system_site_packages
stage "Validating installed runtime"
if check_venv_runtime; then
+11 -1
View File
@@ -29,6 +29,7 @@ from datetime import datetime
from typing import List, Optional
import cherrypy
from repeater.service_utils import is_buildroot
logger = logging.getLogger("HTTPServer")
@@ -808,9 +809,18 @@ def _do_install() -> None:
_state.append_line(f"[pyMC updater] Installing from channel '{channel}'")
_UPGRADE_WRAPPER = "/usr/local/bin/pymc-do-upgrade"
_BUILDROOT_UPGRADE_HELPER = "/root/scripts/buildroot-manage.sh"
is_root = (_os.geteuid() == 0)
if is_root:
if is_root and is_buildroot():
env["PYMC_REPEATER_REF"] = channel
env["PYMC_CORE_REF"] = channel
_state.append_line(f"[pyMC updater] Buildroot image detected using {_BUILDROOT_UPGRADE_HELPER}")
if not os.path.isfile(_BUILDROOT_UPGRADE_HELPER):
_state.finish_install(False, f"Buildroot upgrade helper not found at {_BUILDROOT_UPGRADE_HELPER}")
return
cmd = ["/bin/sh", _BUILDROOT_UPGRADE_HELPER, "upgrade"]
elif is_root:
_migrate_service_unit()
# Ensure venv exists (migration from system-pip era)