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>
This commit is contained in:
parent
5486786495
commit
f8307c3bb4
|
@ -37,6 +37,9 @@ export DOCKER_COMMIT?=$(shell git log -n 1 --pretty=%h)
|
||||||
# SDK architecture
|
# SDK architecture
|
||||||
export COREBOOT_CROSSGCC_PARAM?=all_without_gdb
|
export COREBOOT_CROSSGCC_PARAM?=all_without_gdb
|
||||||
|
|
||||||
|
UID ?= $(shell id -u)
|
||||||
|
GID ?= $(shell id -g)
|
||||||
|
|
||||||
test-docker:
|
test-docker:
|
||||||
$(if $(DOCKER),,\
|
$(if $(DOCKER),,\
|
||||||
$(warning Docker command not found. Please install docker) \
|
$(warning Docker command not found. Please install docker) \
|
||||||
|
@ -97,23 +100,21 @@ docker-cleanall:
|
||||||
|
|
||||||
docker-build-coreboot: test-docker
|
docker-build-coreboot: test-docker
|
||||||
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
||||||
|
--user $(UID):$(GID) \
|
||||||
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
|
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
|
||||||
/bin/bash -c "cd /home/coreboot/coreboot && \
|
/bin/bash -c "cd /home/coreboot/coreboot && \
|
||||||
make clean && \
|
make clean && \
|
||||||
make $(BUILD_CMD)"
|
make $(BUILD_CMD); \
|
||||||
@echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"
|
rm .xcompile"
|
||||||
@echo "Exiting now will leave built files owned by root"
|
|
||||||
sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)
|
|
||||||
|
|
||||||
docker-abuild: test-docker
|
docker-abuild: test-docker
|
||||||
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
||||||
|
--user $(UID):$(GID) \
|
||||||
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
|
--rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \
|
||||||
/bin/bash -c "cd /home/coreboot/coreboot && \
|
/bin/bash -c "cd /home/coreboot/coreboot && \
|
||||||
make clean && \
|
make clean && \
|
||||||
util/abuild/abuild $(ABUILD_ARGS)"
|
util/abuild/abuild $(ABUILD_ARGS); \
|
||||||
@echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"
|
rm -f .xcompile"
|
||||||
@echo "Exiting now will leave built files owned by root"
|
|
||||||
sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)
|
|
||||||
|
|
||||||
docker-what-jenkins-does: test-docker
|
docker-what-jenkins-does: test-docker
|
||||||
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
|
||||||
|
|
Loading…
Reference in New Issue