|
|
@@ -423,34 +423,41 @@ RUN chmod 0755 /usr/local/lib/selkies_joystick_interposer.so
|
|
|
|
|
|
# Create the regular desktop user. sudo-root is kept because Xorg and the
|
|
|
# NVIDIA userspace installer need a few targeted root operations at runtime.
|
|
|
-RUN groupadd --gid "${USER_GID}" "${USER_NAME}" \
|
|
|
- && useradd \
|
|
|
- --uid "${USER_UID}" \
|
|
|
- --gid "${USER_GID}" \
|
|
|
- --create-home \
|
|
|
- --shell /bin/bash \
|
|
|
- "${USER_NAME}" \
|
|
|
- && for group in \
|
|
|
+RUN set -eux; \
|
|
|
+ if ! getent group "${USER_NAME}" >/dev/null; then \
|
|
|
+ groupadd --gid "${USER_GID}" "${USER_NAME}"; \
|
|
|
+ fi; \
|
|
|
+ if ! id -u "${USER_NAME}" >/dev/null 2>&1; then \
|
|
|
+ useradd \
|
|
|
+ --uid "${USER_UID}" \
|
|
|
+ --gid "${USER_NAME}" \
|
|
|
+ --create-home \
|
|
|
+ --shell /bin/bash \
|
|
|
+ "${USER_NAME}"; \
|
|
|
+ else \
|
|
|
+ usermod --shell /bin/bash "${USER_NAME}"; \
|
|
|
+ fi; \
|
|
|
+ for group in \
|
|
|
adm audio cdrom dialout dip fax floppy games input lp plugdev render \
|
|
|
ssl-cert sudo tape tty video voice; \
|
|
|
- do \
|
|
|
+ do \
|
|
|
getent group "${group}" >/dev/null \
|
|
|
&& usermod -aG "${group}" "${USER_NAME}" \
|
|
|
|| true; \
|
|
|
- done \
|
|
|
- && echo "${USER_NAME} ALL=(ALL:ALL) NOPASSWD: ALL" \
|
|
|
- > "/etc/sudoers.d/${USER_NAME}" \
|
|
|
- && chmod 0440 "/etc/sudoers.d/${USER_NAME}" \
|
|
|
- && echo "${USER_NAME}:${PASSWD}" | chpasswd \
|
|
|
- && cp -a /usr/bin/sudo /usr/bin/sudo-root \
|
|
|
- && chown root:root /usr/bin/sudo-root \
|
|
|
- && chmod 4755 /usr/bin/sudo-root \
|
|
|
- && install -d \
|
|
|
+ done; \
|
|
|
+ echo "${USER_NAME} ALL=(ALL:ALL) NOPASSWD: ALL" \
|
|
|
+ > "/etc/sudoers.d/${USER_NAME}"; \
|
|
|
+ chmod 0440 "/etc/sudoers.d/${USER_NAME}"; \
|
|
|
+ echo "${USER_NAME}:${PASSWD}" | chpasswd; \
|
|
|
+ cp -a /usr/bin/sudo /usr/bin/sudo-root; \
|
|
|
+ chown root:root /usr/bin/sudo-root; \
|
|
|
+ chmod 4755 /usr/bin/sudo-root; \
|
|
|
+ install -d \
|
|
|
-o "${USER_UID}" \
|
|
|
-g "${USER_GID}" \
|
|
|
-m 0700 \
|
|
|
- /tmp/runtime-ubuntu \
|
|
|
- && chown -R \
|
|
|
+ /tmp/runtime-ubuntu; \
|
|
|
+ chown -R \
|
|
|
"${USER_UID}:${USER_GID}" \
|
|
|
"/home/${USER_NAME}" \
|
|
|
/etc/X11 \
|