File tree Expand file tree Collapse file tree 3 files changed +55
-4
lines changed
Expand file tree Collapse file tree 3 files changed +55
-4
lines changed Original file line number Diff line number Diff line change @@ -85,3 +85,4 @@ ENV IDF_CCACHE_ENABLE=1
8585
8686WORKDIR /opt/esp/lib-builder
8787ENTRYPOINT [ "/opt/esp/lib-builder/entrypoint.sh" ]
88+ CMD [ "bash" ]
Original file line number Diff line number Diff line change 1515 done
1616fi
1717
18- if [ " $( id -u) " = " 0" ]; then
18+ if [ " $( id -u) " = " 0" ] && [ -n " ${HOST_UID} " ] ; then
1919 groupadd -g ${HOST_UID} host_user
2020 useradd -m -u ${HOST_UID} -g ${HOST_UID} host_user
21- chown -R ${HOST_UID} :${HOST_UID} /arduino-esp32
21+
22+ if [ -d /arduino-esp32 ]; then
23+ chown -R ${HOST_UID} :${HOST_UID} /arduino-esp32
24+ fi
25+
2226 chown -R ${HOST_UID} :${HOST_UID} /opt/esp
2327
2428 # Add call to gosu to drop from root user to host_user
2529 # when running original entrypoint
26- set -- gosu host_user " $@ " -c /arduino-esp32
30+ set -- gosu host_user " $@ "
2731fi
2832
29- exec " $@ " -c /arduino-esp32
33+ exec " $@ "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ i=0
4+ NEXT_ARG=" false"
5+ ARDUINO_DIR=" "
6+ DOCKER_ARGS=()
7+ ORIGINAL_ARGS=(" $@ " )
8+ TRIMMED_ARGS=()
9+
10+ while [ $i -lt ${# ORIGINAL_ARGS[@]} ]; do
11+ arg=${ORIGINAL_ARGS[$i]}
12+ if [ $arg == " -c" ]; then
13+ NEXT_ARG=" true"
14+ elif [ $NEXT_ARG == " true" ]; then
15+ ARDUINO_DIR=$arg
16+ NEXT_ARG=" false"
17+ else
18+ TRIMMED_ARGS+=($arg )
19+ fi
20+ i=$(( i + 1 ))
21+ done
22+
23+ if [ -n " $ARDUINO_DIR " ]; then
24+ if [ ! -d " $ARDUINO_DIR " ]; then
25+ echo " Arduino directory \" $ARDUINO_DIR \" does not exist"
26+ exit 1
27+ fi
28+ ARDUINO_DIR=$( echo $( cd $ARDUINO_DIR ; pwd) )
29+ DOCKER_ARGS+=(-v $ARDUINO_DIR :/arduino-esp32)
30+ TRIMMED_ARGS+=(-c /arduino-esp32)
31+ fi
32+
33+ DOCKER_ARGS+=(-e HOST_UID=$UID )
34+
35+ if [ -n " $LIBBUILDER_GIT_SAFE_DIR " ]; then
36+ DOCKER_ARGS+=(-e LIBBUILDER_GIT_SAFE_DIR=$LIBBUILDER_GIT_SAFE_DIR )
37+ fi
38+
39+ if [ " $VERBOSE_OUTPUT " -eq 1 ]; then
40+ echo " Arguments:"
41+ echo " DOCKER_ARGS = ${DOCKER_ARGS[@]} "
42+ echo " TRIMMED_ARGS = ${TRIMMED_ARGS[@]} "
43+ echo " Running: docker run ${DOCKER_ARGS[@]} lucassvaz/esp32-arduino-lib-builder ./build.sh ${TRIMMED_ARGS[@]} "
44+ fi
45+
46+ docker run ${DOCKER_ARGS[@]} lucassvaz/esp32-arduino-lib-builder ./build.sh ${TRIMMED_ARGS[@]}
You can’t perform that action at this time.
0 commit comments