-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
# Create group and user based on environment variables | ||
if [ ! "$(getent group "$PGID")" ]; then | ||
# If groupadd exists, use it | ||
if command -v groupadd > /dev/null; then | ||
groupadd -g "$PGID" jellyplex_group | ||
else | ||
addgroup -g "$PGID" jellyplex_group | ||
fi | ||
fi | ||
|
||
if [ ! "$(getent passwd "$PUID")" ]; then | ||
# If useradd exists, use it | ||
if command -v useradd > /dev/null; then | ||
useradd --no-create-home -u "$PUID" -g "$PGID" jellyplex_user | ||
else | ||
adduser -D -H -u "$PUID" -G jellyplex_group jellyplex_user | ||
fi | ||
fi | ||
|
||
# Adjust ownership of the application directory | ||
chown -R "$PUID:$PGID" /app | ||
|
||
# Run the application as the created user | ||
exec gosu "$PUID:$PGID" "$@" |