diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-08-06 15:16:32 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-08-06 15:16:35 +1000 |
commit | ae0d13e59693667b45dcce12a9229346b7266f33 (patch) | |
tree | 5d58bc1c948adef09646d5f31d70f81dfe0a39fb /ci/build.sh | |
parent | 86f9bb876c6981c1be56708d48f4032d06f7fc74 (diff) | |
download | blackbird-op-build-ae0d13e59693667b45dcce12a9229346b7266f33.tar.gz blackbird-op-build-ae0d13e59693667b45dcce12a9229346b7266f33.zip |
ci: Add -b option to specify custom mount point
Use '-b' to specify a bind mount point to use instead of the current
working directory. This is useful if we need access parent directories.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ci/build.sh')
-rwxr-xr-x | ci/build.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ci/build.sh b/ci/build.sh index c8046d4a..45da32c9 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,12 +2,16 @@ CONTAINERS="ubuntu1604 fedora27" -while getopts ":ahp:c:" opt; do +while getopts ":ab:hp:c:" opt; do case $opt in a) echo "Build firmware images for all the platforms" PLATFORMS="" ;; + b) + echo "Directory to bind to container: $OPTARG" + BIND="$OPTARG" + ;; p) echo "Build firmware images for the platforms: $OPTARG" PLATFORMS=$OPTARG @@ -20,6 +24,7 @@ while getopts ":ahp:c:" opt; do echo "Usage: ./ci/build.sh [options] [--]" echo "-h Print this help and exit successfully." echo "-a Build firmware images for all the platform defconfig's." + echo "-b DIR Bind DIR to container." echo "-p List of comma separated platform names to build images for particular platforms." echo "-c Container to run in" echo "Example:DOCKER_PREFIX=sudo ./ci/build.sh -a" @@ -43,8 +48,13 @@ set -eo pipefail function run_docker { + if [ -n "$BIND" ]; then + BINDARG="--mount=type=bind,src=${BIND},dst=${BIND}" + else + BINDARG="--mount=type=bind,src=${PWD},dst=${PWD}" + fi $DOCKER_PREFIX docker run --cap-add=sys_admin --net=host --rm=true \ - --user="${USER}" -w "${PWD}" -v "${PWD}":"${PWD}":Z \ + --user="${USER}" -w "${PWD}" "${BINDARG}" \ -t $1 $2 } |