<p>Martin Roth has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/26594">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">util/docker: Fix file ownership when building with coreboot-sdk<br><br>Instead of requiring the user to enter their root password to set the<br>created files to their user, create a new user inside the docker<br>container with the correct UID & GID and build with that.<br><br>Change-Id: Ibbeff00211e8cf653f48204d285e06bca39b5fd2<br>Signed-off-by: Martin Roth <martinroth@google.com><br>---<br>M util/docker/Makefile<br>1 file changed, 9 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/26594/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/util/docker/Makefile b/util/docker/Makefile</span><br><span>index f70ee89..85f6a54 100644</span><br><span>--- a/util/docker/Makefile</span><br><span>+++ b/util/docker/Makefile</span><br><span>@@ -37,6 +37,9 @@</span><br><span> # SDK architecture</span><br><span> export COREBOOT_CROSSGCC_PARAM?=all_without_gdb</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+UID ?= $(shell echo $$UID)</span><br><span style="color: hsl(120, 100%, 40%);">+GID ?= $(shell id -g $$(whoami))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> test-docker:</span><br><span>         $(if $(DOCKER),,\</span><br><span>            $(warning Docker command not found.  Please install docker) \</span><br><span>@@ -99,21 +102,17 @@</span><br><span>         $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \</span><br><span>                --rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \</span><br><span>           /bin/bash -c "cd /home/coreboot/coreboot && \</span><br><span style="color: hsl(0, 100%, 40%);">-              make clean && \</span><br><span style="color: hsl(0, 100%, 40%);">-         make $(BUILD_CMD)"</span><br><span style="color: hsl(0, 100%, 40%);">- @echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"</span><br><span style="color: hsl(0, 100%, 40%);">-        @echo "Exiting now will leave built files owned by root"</span><br><span style="color: hsl(0, 100%, 40%);">-      sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)</span><br><span style="color: hsl(120, 100%, 40%);">+         groupadd --gid $(GID) cbuser && \</span><br><span style="color: hsl(120, 100%, 40%);">+             useradd --uid $(UID) --gid $(GID) cbuser && \</span><br><span style="color: hsl(120, 100%, 40%);">+         su cbuser -c 'make clean && make $(BUILD_CMD)'"</span><br><span> </span><br><span> docker-abuild: test-docker</span><br><span>       $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \</span><br><span>                --rm coreboot/coreboot-sdk:$(COREBOOT_CONTAINER_VERSION) \</span><br><span>           /bin/bash -c "cd /home/coreboot/coreboot && \</span><br><span style="color: hsl(0, 100%, 40%);">-              make clean && \</span><br><span style="color: hsl(0, 100%, 40%);">-         util/abuild/abuild $(ABUILD_ARGS)"</span><br><span style="color: hsl(0, 100%, 40%);">- @echo "Enter root password to chown files to $$(whoami):$$(id -gn $$(whoami))"</span><br><span style="color: hsl(0, 100%, 40%);">-        @echo "Exiting now will leave built files owned by root"</span><br><span style="color: hsl(0, 100%, 40%);">-      sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)</span><br><span style="color: hsl(120, 100%, 40%);">+         groupadd --gid $(GID) cbuser && \</span><br><span style="color: hsl(120, 100%, 40%);">+             useradd --uid $(UID) --gid $(GID) cbuser && \</span><br><span style="color: hsl(120, 100%, 40%);">+         su cbuser -c 'make clean && util/abuild/abuild $(ABUILD_ARGS)'"</span><br><span> </span><br><span> docker-what-jenkins-does: test-docker</span><br><span>    $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/26594">change 26594</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/26594"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibbeff00211e8cf653f48204d285e06bca39b5fd2 </div>
<div style="display:none"> Gerrit-Change-Number: 26594 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Martin Roth <martinroth@google.com> </div>