osmith submitted this change.
OBS: build_binpkg: fix building for ubuntu 24.04
Delete the user with the given UID if it already exists, so the image
can be built for ubuntu 24.04 too with UID=1000:
> [3/6] RUN USERADD --uid=1000 -m user:
0.166 useradd: UID 1000 is not unique
Change-Id: I85acbf2de53f02a65ef72d4fed8c2918ec6fa317
---
M scripts/obs/data/build_binpkg.Dockerfile
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/obs/data/build_binpkg.Dockerfile b/scripts/obs/data/build_binpkg.Dockerfile
index 0a96272..ba26a2d 100644
--- a/scripts/obs/data/build_binpkg.Dockerfile
+++ b/scripts/obs/data/build_binpkg.Dockerfile
@@ -6,7 +6,11 @@
COPY Release.key /usr/share/keyrings/osmocom.asc
-RUN useradd --uid=${UID} -m user
+RUN set -x && \
+ if id "${UID}" >/dev/null 2>&1; then \
+ userdel "$(getent passwd "${UID}" | cut -d: -f1)"; \
+ fi && \
+ useradd --uid=${UID} -m user
# Only install build-essential here, and what's needed to add the Osmocom
# repository. Everything else must be defined as dependency in the package
To view, visit change 40329. To unsubscribe, or for help writing mail filters, visit settings.