From a20f6a53f2d2cafc0c48262d39753637b41d742a Mon Sep 17 00:00:00 2001 From: Stuart Pernsteiner Date: Tue, 10 Sep 2024 16:54:14 -0700 Subject: [PATCH] ardupilot: add more comments to build scripts --- components/autopilot/ardupilot_build.sh | 2 +- components/autopilot/ardupilot_init_submodules.sh | 3 ++- components/autopilot/ardupilot_install_deps.sh | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/autopilot/ardupilot_build.sh b/components/autopilot/ardupilot_build.sh index 89bdd256..a38028d4 100644 --- a/components/autopilot/ardupilot_build.sh +++ b/components/autopilot/ardupilot_build.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -# Script for installing ArduPilot build dependencies. +# Build the ArduPilot SITL binary for aarch64. cd "$(dirname "$0")/ardupilot" diff --git a/components/autopilot/ardupilot_init_submodules.sh b/components/autopilot/ardupilot_init_submodules.sh index 75c82ace..9bc67988 100644 --- a/components/autopilot/ardupilot_init_submodules.sh +++ b/components/autopilot/ardupilot_init_submodules.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -# Initialize additional submodules that are needed for the ArduPilot build. +# Initialize ArduPilot submodules that are needed for the SITL build. cd "$(dirname "$0")/ardupilot" @@ -17,6 +17,7 @@ modules=( DroneCAN/DSDL DroneCAN/libcanard ) + for x in "${modules[@]}"; do edo git submodule update --init "modules/$x" done diff --git a/components/autopilot/ardupilot_install_deps.sh b/components/autopilot/ardupilot_install_deps.sh index 4af56fc2..b0264663 100644 --- a/components/autopilot/ardupilot_install_deps.sh +++ b/components/autopilot/ardupilot_install_deps.sh @@ -10,10 +10,15 @@ edo() { "$@" } +# Echo the first argument. This is useful for expanding a (possible) glob +# pattern to a single concrete filename. first() { echo "$1" } +# Install a package with `apt-get`, but only if a certain file is missing from +# the system. Running `apt-get install` on an already-installed package is a +# no-op, but we'd like to avoid asking for `sudo` privileges unnecessarily. install_if_missing() { local package="$1" local file="$2"