mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-21 00:01:55 -09:00
utils/docker-run: mount and pass BR2_EXTERNAL dirs
The BR2_EXTERNAL environment variable is passed into the container, and each path listed in it mounted. This allows using external trees when running a build using utils/docker-run. Testing the existence of the variable instead of a non-empty value allows passing an empty BR2_EXTERNAL variable to disable currently set external trees. The --mount option needs an absolute path for the destination. Make the paths absolute the same way br2-external itself does it. Do not use realpath since that resolves symlinks and would make it different from what is in the BR2_EXTERNAL variable. Signed-off-by: Fiona Klute <fiona.klute@gmx.de> Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
This commit is contained in:
committed by
Arnout Vandecappelle
parent
f1fae6867b
commit
ddd4788c1f
@@ -97,6 +97,17 @@ if [ "${BR2_DL_DIR}" ]; then
|
||||
docker_opts+=( --env BR2_DL_DIR )
|
||||
fi
|
||||
|
||||
# Testing the existence of the variable instead of a non-empty value
|
||||
# allows passing an empty BR2_EXTERNAL variable to disable currently
|
||||
# set external trees.
|
||||
if [ "${BR2_EXTERNAL+set}" ]; then
|
||||
docker_opts+=( --env BR2_EXTERNAL )
|
||||
for br2_ext in ${BR2_EXTERNAL//:/ }; do
|
||||
# bind volume source paths must be absolute
|
||||
mountpoints+=( "$(cd "${br2_ext}" && pwd)" )
|
||||
done
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2013 # can't use while-read because of the assignment
|
||||
for dir in $(printf '%s\n' "${mountpoints[@]}" |LC_ALL=C sort -u); do
|
||||
docker_opts+=( --mount "type=bind,src=${dir},dst=${dir}" )
|
||||
|
||||
Reference in New Issue
Block a user