summaryrefslogtreecommitdiff
path: root/util/docker/Makefile
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2018-05-27 14:53:02 -0600
committerPatrick Georgi <pgeorgi@google.com>2018-05-30 17:15:25 +0000
commitf8307c3bb4260303db209dc94e4d4f4b4d131632 (patch)
tree36a2ac656a362665df59bb0de86974d2bf25442d /util/docker/Makefile
parent54867864958262a57c60267df51c717a5bb8cc1d (diff)
downloadcoreboot-f8307c3bb4260303db209dc94e4d4f4b4d131632.tar.xz
util/docker: Fix file ownership when building with coreboot-sdk
Instead of requiring the user to enter their root password to set the created files to their user, create a new user inside the docker container with the correct UID & GID and build with that. Change-Id: Ibbeff00211e8cf653f48204d285e06bca39b5fd2 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/26594 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/docker/Makefile')
-rw-r--r--util/docker/Makefile17
1 files changed, 9 insertions, 8 deletions
diff --git a/util/docker/Makefile b/util/docker/Makefile
index f70ee8908e..60e244f162 100644
--- a/util/docker/Makefile
+++ b/util/docker/Makefile
@@ -37,6 +37,9 @@ export DOCKER_COMMIT?=$(shell git log -n 1 --pretty=%h)
# SDK architecture
export COREBOOT_CROSSGCC_PARAM?=all_without_gdb
+UID ?= $(shell id -u)
+GID ?= $(shell id -g)
+
test-docker:
$(if $(DOCKER),,\
$(warning Docker command not found. Please install docker) \
@@ -97,23 +100,21 @@ docker-cleanall:
docker-build-coreboot: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
+ --user $(UID):$(GID) \
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
/bin/bash -c "cd /home/coreboot/coreboot && \
make clean && \
- make $(BUILD_CMD)"
- @echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"
- @echo "Exiting now will leave built files owned by root"
- sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)
+ make $(BUILD_CMD); \
+ rm .xcompile"
docker-abuild: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
+ --user $(UID):$(GID) \
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
/bin/bash -c "cd /home/coreboot/coreboot && \
make clean && \
- util/abuild/abuild $(ABUILD_ARGS)"
- @echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"
- @echo "Exiting now will leave built files owned by root"
- sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)
+ util/abuild/abuild $(ABUILD_ARGS); \
+ rm -f .xcompile"
docker-what-jenkins-does: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \