[coreboot-gerrit] Change in coreboot[master]: util/docker: Fix file ownership when building with coreboot-sdk
Martin Roth (Code Review)
gerrit at coreboot.org
Sun May 27 22:53:58 CEST 2018
Martin Roth has uploaded this change for review. ( https://review.coreboot.org/26594
Change subject: util/docker: Fix file ownership when building with coreboot-sdk
......................................................................
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 at google.com>
---
M util/docker/Makefile
1 file changed, 9 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/26594/1
diff --git a/util/docker/Makefile b/util/docker/Makefile
index f70ee89..85f6a54 100644
--- a/util/docker/Makefile
+++ b/util/docker/Makefile
@@ -37,6 +37,9 @@
# SDK architecture
export COREBOOT_CROSSGCC_PARAM?=all_without_gdb
+UID ?= $(shell echo $$UID)
+GID ?= $(shell id -g $$(whoami))
+
test-docker:
$(if $(DOCKER),,\
$(warning Docker command not found. Please install docker) \
@@ -99,21 +102,17 @@
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
--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)
+ groupadd --gid $(GID) cbuser && \
+ useradd --uid $(UID) --gid $(GID) cbuser && \
+ su cbuser -c 'make clean && make $(BUILD_CMD)'"
docker-abuild: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
--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)
+ groupadd --gid $(GID) cbuser && \
+ useradd --uid $(UID) --gid $(GID) cbuser && \
+ su cbuser -c 'make clean && util/abuild/abuild $(ABUILD_ARGS)'"
docker-what-jenkins-does: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
--
To view, visit https://review.coreboot.org/26594
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbeff00211e8cf653f48204d285e06bca39b5fd2
Gerrit-Change-Number: 26594
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180527/fe52ea14/attachment.html>
More information about the coreboot-gerrit
mailing list