IQ.Pilot Release Commit @ bec7652
This commit is contained in:
54
iqpilot/system/proprietary_runtime/install_verified_runtime.sh
Executable file
54
iqpilot/system/proprietary_runtime/install_verified_runtime.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||
RUNTIME_ROOT="${IQPILOT_VERIFIED_RUNTIME_ROOT:-/usr/libexec/iqpilot}"
|
||||
PYTHON_ROOT="${RUNTIME_ROOT}/python"
|
||||
TARGET_EXT_DIR="${PYTHON_ROOT}/openpilot/system/proprietary_runtime"
|
||||
MANIFEST_SRC="${ROOT}/iqpilot/system/proprietary_runtime/rootfs_integrity.json"
|
||||
MANIFEST_SIG_SRC="${ROOT}/iqpilot/system/proprietary_runtime/rootfs_integrity.json.sig"
|
||||
|
||||
RUNNER_SRC="${ROOT}/iqpilot/system/proprietary_runtime/iqpilot_bundle_runner"
|
||||
EXT_SRC="${ROOT}/iqpilot/system/proprietary_runtime/_verified_import.so"
|
||||
STUB_ROOT="${ROOT}/iqpilot/system/proprietary_runtime/rootfs_python"
|
||||
|
||||
if [ ! -x "${RUNNER_SRC}" ]; then
|
||||
echo "missing runner: ${RUNNER_SRC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${EXT_SRC}" ]; then
|
||||
# No locally-built _verified_import.so staged in the tree. This is the NORMAL prebuilt/release case:
|
||||
# the .so is gitignored and ships baked into the OS image at /usr/libexec/iqpilot, so there is
|
||||
# nothing to install from /data. Quietly no-op and let the OS-baked verified runtime be used.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "${MANIFEST_SRC}" ] || [ ! -f "${MANIFEST_SIG_SRC}" ]; then
|
||||
if [ -n "${IQPILOT_SIGNING_KEY:-}" ]; then
|
||||
"${ROOT}/.venv/bin/python" \
|
||||
"${ROOT}/scripts/iqpilot/build_proprietary_runtime_manifest.py" \
|
||||
--repo-root "${ROOT}" \
|
||||
--output "${MANIFEST_SRC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${MANIFEST_SRC}" ] || [ ! -f "${MANIFEST_SIG_SRC}" ]; then
|
||||
echo "missing rootfs runtime integrity manifest or signature"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo mount -o remount,rw /
|
||||
trap 'sudo mount -o remount,ro /' EXIT
|
||||
|
||||
sudo mkdir -p "${RUNTIME_ROOT}" "${TARGET_EXT_DIR}"
|
||||
sudo install -m 0755 "${RUNNER_SRC}" "${RUNTIME_ROOT}/iqpilot_bundle_runner"
|
||||
sudo install -m 0755 "${EXT_SRC}" "${TARGET_EXT_DIR}/_verified_import.so"
|
||||
sudo install -m 0644 "${MANIFEST_SRC}" "${RUNTIME_ROOT}/runtime_integrity.json"
|
||||
sudo install -m 0644 "${MANIFEST_SIG_SRC}" "${RUNTIME_ROOT}/runtime_integrity.json.sig"
|
||||
sudo install -m 0644 "${STUB_ROOT}/openpilot/__init__.py" "${PYTHON_ROOT}/openpilot/__init__.py"
|
||||
sudo mkdir -p "${PYTHON_ROOT}/openpilot/system"
|
||||
sudo install -m 0644 "${STUB_ROOT}/openpilot/system/__init__.py" "${PYTHON_ROOT}/openpilot/system/__init__.py"
|
||||
sudo install -m 0644 "${STUB_ROOT}/openpilot/system/proprietary_runtime/__init__.py" "${TARGET_EXT_DIR}/__init__.py"
|
||||
|
||||
echo "installed verified runtime to ${RUNTIME_ROOT}"
|
||||
Reference in New Issue
Block a user