Skip to content

Commit

Permalink
GH-1934 Check if user/group already exist in entrypoint.sh (Fix #1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
houkunlin authored Sep 18, 2023
1 parent b22e0e9 commit 9e41e37
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ if [ "$UID" -ne "0" ]; then
$REPOSILITE_ARGS
else
GROUP_ID="${PGID:-999}"
addgroup --gid "$GROUP_ID" reposilite
grep "^reposilite" /etc/group > /dev/null
if [ $? -ne 0 ]
then
addgroup --gid "$GROUP_ID" reposilite
fi

USER_ID="${PUID:-999}"
adduser --system -uid "$USER_ID" --ingroup reposilite --shell /bin/sh reposilite
grep "^reposilite" /etc/passwd > /dev/null
if [ $? -ne 0 ]
then
adduser --system -uid "$USER_ID" --ingroup reposilite --shell /bin/sh reposilite
fi

chown -R reposilite:reposilite /app
chown -R reposilite:reposilite /var/log/reposilite
Expand Down

0 comments on commit 9e41e37

Please sign in to comment.