From ed6c2c7d096a00511e58a52481ad5f17a7ddb30e Mon Sep 17 00:00:00 2001 From: Andrei Radulescu Date: Sun, 22 Feb 2026 23:11:11 +0200 Subject: [PATCH] op: fallback to script's own location for openpilot root Derive the openpilot directory from BASH_SOURCE when the working directory isn't inside the repo, so op commands work from anywhere without needing --dir. --- tools/op.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/op.sh b/tools/op.sh index 8c41926e0ce0ba8..fefb2e0652e094d 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -62,7 +62,8 @@ function op_get_openpilot_dir() { done # Fallback to hardcoded directories if not found - for dir in "$HOME/openpilot" "/data/openpilot"; do + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" + for dir in "${SCRIPT_DIR%/tools}" "$HOME/openpilot" "/data/openpilot"; do if [[ -f "$dir/launch_openpilot.sh" ]]; then OPENPILOT_ROOT="$dir" return 0