mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Several helper scripts assumes bash is available at /bin/bash. That breaks on systems such as NixOS, where bash is resolved from PATH instead of a fixed /bin location and causes failures like `bad interpreter` during `make format`, e.g., on my host machine: ```sh $ make format /PX4-Autopilot/Tools/astyle/check_code_style.sh: /PX4-Autopilot/Tools/astyle/fix_code_style.sh: /bin/bash: bad interpreter: No such file or directory ``` This change switches these entrypoints to `#!/usr/bin/env bash` so they locate bash properly. No functional changes intended. Signed-off-by: Onur Özkan <work@onurozkan.dev>
28 lines
676 B
Bash
Executable File
28 lines
676 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
|
PX4_DOCKER_REPO="px4io/px4-dev:v1.17.0-beta1"
|
|
else
|
|
echo "PX4_DOCKER_REPO is set to '$PX4_DOCKER_REPO'";
|
|
fi
|
|
|
|
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
|
|
|
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
SRC_DIR=${SCRIPT_DIR}/../
|
|
|
|
CCACHE_DIR=${HOME}/.ccache
|
|
mkdir -p "${CCACHE_DIR}"
|
|
|
|
docker run -it --rm -w "${SRC_DIR}" \
|
|
--user="$(id -u):$(id -g)" \
|
|
--env=CCACHE_DIR="${CCACHE_DIR}" \
|
|
--env=PX4_ASAN \
|
|
--env=PX4_MSAN \
|
|
--env=PX4_TSAN \
|
|
--env=PX4_UBSAN \
|
|
--publish 14556:14556/udp \
|
|
--volume=${CCACHE_DIR}:${CCACHE_DIR}:rw \
|
|
--volume=${SRC_DIR}:${SRC_DIR}:rw \
|
|
${PX4_DOCKER_REPO} /bin/bash -c "$@"
|