Files
StarPilot/scripts/install_boot_logo.sh
firestar5683 a9caa495b7 Replay Helpers
Provide UI replay and startup helpers for inspecting onroad rendering without a live drive.

Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
2026-10-14 20:02:39 -05:00

38 lines
1018 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SOURCE="$ROOT_DIR/openpilot/selfdrive/assets/images/starpilot_boot.png"
TARGET="/usr/comma/bg.png"
[[ -f /AGNOS && -f "$SOURCE" && -f "$TARGET" ]] || exit 0
grep -Fq 'BACKGROUND = "/usr/comma/bg.png"' /usr/comma/magic.py || exit 0
cmp -s "$SOURCE" "$TARGET" && exit 0
mount_options="$(findmnt -n -o OPTIONS --target /)"
restore_readonly=false
case ",$mount_options," in
*,ro,*) restore_readonly=true ;;
*,rw,*) ;;
*) echo "Could not determine boot image filesystem permissions" >&2; exit 1 ;;
esac
staged="$TARGET.starpilot-$$"
cleanup() {
local result=$?
sudo -n rm -f -- "$staged" || true
if "$restore_readonly"; then
sudo -n mount -o remount,ro / || return 1
fi
return "$result"
}
trap cleanup EXIT
if "$restore_readonly"; then
sudo -n mount -o remount,rw /
fi
sudo -n install -m 0644 -- "$SOURCE" "$staged"
cmp -s "$SOURCE" "$staged"
sudo -n mv -f -- "$staged" "$TARGET"
sync -f "$TARGET"