From 902082200d55e4c7ac69a9cd9c9bc24bf4a00887 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Mon, 15 Aug 2022 19:26:28 +0530 Subject: [PATCH] fix: create user if it doesn't exist --- .github/workflows/coverage.yml | 1 - .gitignore | 1 + scripts/entrypoint.sh | 14 ++++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1b136ab..452f32f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -40,7 +40,6 @@ jobs: if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request') uses: actions-rs/tarpaulin@v0.1 with: - version: '0.18.2' args: '-t 1200' env: # GIT_HASH is dummy value. I guess build.rs is skipped in tarpaulin diff --git a/.gitignore b/.gitignore index ea8c4bf..d5aabfe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +tarpaulin-report.html diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index a072312..c11d4f7 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -2,11 +2,17 @@ USER_ID=${LOCAL_USER_ID} echo $USER_ID +LIBREPAGES_USER=librepages echo "Starting with UID : $USER_ID" -export HOME=/home/user +export HOME=/home/$LIBREPAGES_USER #adduser --disabled-password --shell /bin/bash --home $HOME --uid $USER_ID user #--uid -sudo useradd --uid $USER_ID -b /home -m -s /bin/bash user -su - user -pages + +if id "$1" &>/dev/null; then + echo "User $LIBREPAGES_USER exists" +else + useradd --uid $USER_ID -b /home -m -s /bin/bash $LIBREPAGES_USER +fi + +su $LIBREPAGES_USER -c 'pages'