Skip to content

Commit

Permalink
feat!: create dapp user when installing tools package
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco authored and mpolitzer committed Apr 18, 2024
1 parent 7f758b6 commit eb2bd16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ RUN mkdir -p ${STAGING_DEBIAN} ${STAGING_SBIN} ${STAGING_BIN} ${STAGING_BASE}/et
echo "cartesi-machine" > ${staging_base}/etc/hostname

COPY control ${STAGING_DEBIAN}/control
COPY postinst ${STAGING_DEBIAN}/postinst

COPY --from=builder ${BUILD_BASE}/tools/sys-utils/cartesi-init/cartesi-init ${STAGING_SBIN}
COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/xhalt/xhalt ${STAGING_SBIN}
Expand Down
1 change: 0 additions & 1 deletion fs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ RUN apt-get update && \
file=1:5.41-3ubuntu0.1 \
/tmp/${TOOLS_DEB} \
&& \
useradd --create-home --user-group dapp && \
rm -rf /var/lib/apt/lists/* /tmp/${TOOLS_DEB}
COPY --chown=root:root --from=cross-builder /tmp/build-extra/benchmarks/whetstone /usr/bin/
COPY --chown=root:root --from=cross-builder /tmp/build-extra/benchmarks/dhrystone /usr/bin/
12 changes: 12 additions & 0 deletions postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -e

USER_NAME="dapp"

# Check if the user already exists
if ! getent passwd $USER_NAME > /dev/null; then
useradd --create-home --user-group $USER_NAME
fi

exit 0

0 comments on commit eb2bd16

Please sign in to comment.