Skip to content

Commit 020c1ca

Browse files
committed
If a group and user with the same IDs already exist, rename the group and
recreate the inav user (for compatibility e.g. ubuntu:noble). pyyaml is installed systemwide via apt-get also for compatibility e.g. ubuntu:noble.
1 parent 0ca7c02 commit 020c1ca

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ ARG GDB
66

77
ENV DEBIAN_FRONTEND=noninteractive
88

9-
RUN apt-get update && apt-get install -y git cmake make ruby gcc python3 python3-pip gcc-arm-none-eabi ninja-build
9+
RUN apt-get update && apt-get install -y git cmake make ruby gcc python3 python3-yaml ninja-build gcc-arm-none-eabi
1010

1111
RUN if [ "$GDB" = "yes" ]; then apt-get install -y gdb; fi
1212

13-
RUN pip install pyyaml
14-
15-
# add inav user and group
16-
RUN addgroup --gid $GROUP_ID inav
17-
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID inav
13+
# If a group and user with the same IDs already exist, rename the group and recreate the user after deleting the existing one.
14+
RUN GROUP="$(id -n -g $GROUP_ID)"; if [ -n "$GROUP" ]; then groupmod -n inav "$GROUP"; else groupadd --gid $GROUP_ID inav; fi
15+
RUN USER="$(id -n -u $USER_ID)"; if [ -n "$USER" ]; then userdel -r "$USER"; fi && useradd -m --uid $USER_ID --gid $GROUP_ID inav
1816

1917
USER inav
2018

0 commit comments

Comments
 (0)