Files
agv_pro_ros2/patches/apply_patches.sh
T
2026-07-17 09:34:33 +00:00

29 lines
857 B
Bash
Executable File

#!/usr/bin/env bash
set -u
ROOT_DIR="/workspaces/agv_pro_ros2"
PATCH_DIR="$ROOT_DIR/patches"
apply_patch_once() {
local target_dir="$1"
local patch_file="$2"
if [[ ! -d "$target_dir/.git" ]]; then
echo "[FAIL] target repo not found: $target_dir" >&2
return 2
fi
if [[ ! -f "$patch_file" ]]; then
echo "[FAIL] patch not found: $patch_file" >&2
return 2
fi
git -C "$target_dir" apply --check "$patch_file" >/dev/null 2>&1 \
&& git -C "$target_dir" apply "$patch_file" >/dev/null 2>&1 \
|| git -C "$target_dir" apply --reverse --check "$patch_file" >/dev/null 2>&1
}
apply_patch_once "$ROOT_DIR/src/upstream/livox_sdk" "$PATCH_DIR/livox_sdk.patch"
apply_patch_once "$ROOT_DIR/src/upstream/slam_gmapping" "$PATCH_DIR/slam_gmapping.patch"
apply_patch_once "$ROOT_DIR/src/upstream/FAST_LIO" "$PATCH_DIR/fast_lio.patch"