build-unit-test-docker: move homedir with usermod
When the uid already exists, we do a usermod instead of a useradd,
but this does not create the new home directory. We need to pass
the `-m` argument in order to move the old home directory to the
new location.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9f2cabe982af0b09d3c3f65dcd3a0acb6b8f3591
diff --git a/scripts/build-unit-test-docker b/scripts/build-unit-test-docker
index 537731f..ba5c5fe 100755
--- a/scripts/build-unit-test-docker
+++ b/scripts/build-unit-test-docker
@@ -885,7 +885,7 @@
fi
RUN mkdir -p "{os.path.dirname(homedir)}"
RUN if grep -q ":{uid}:" /etc/passwd ; then \
- usermod -l {username} -d {homedir} $(awk -F : '{{ if ($3 == {uid}) {{ print $1 }} }}' /etc/passwd) ; \
+ usermod -l {username} -d {homedir} -m $(awk -F : '{{ if ($3 == {uid}) {{ print $1 }} }}' /etc/passwd) ; \
else \
useradd -d {homedir} -m -u {uid} -g {gid} {username} ; \
fi