2021-09-17 13:57:27 -07:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2021-09-18 09:51:05 -07:00
|
|
|
# set -e Exit the script if an error happens
|
2021-09-17 13:57:27 -07:00
|
|
|
set -e
|
2021-09-18 02:33:25 -07:00
|
|
|
PUID=${PUID=1000}
|
|
|
|
PGID=${PGID=1000}
|
2021-09-17 13:57:27 -07:00
|
|
|
|
|
|
|
files_ownership () {
|
2021-09-18 09:51:05 -07:00
|
|
|
# -h Changes the ownership of an encountered symbolic link and not that of the file or directory pointed to by the symbolic link.
|
|
|
|
# -R Recursively descends the specified directories
|
|
|
|
# -c Like verbose but report only when a change is made
|
2021-09-18 02:33:25 -07:00
|
|
|
chown -hRc "$PUID":"$PGID" /app/data
|
2021-09-17 13:57:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "==> Performing startup jobs and maintenance tasks"
|
|
|
|
files_ownership
|
|
|
|
|
2021-09-18 02:33:25 -07:00
|
|
|
echo "==> Starting application with user $PUID group $PGID"
|
2021-09-18 09:51:05 -07:00
|
|
|
|
|
|
|
# --clear-groups Clear supplementary groups.
|
2021-09-18 02:33:25 -07:00
|
|
|
exec setpriv --reuid "$PUID" --regid "$PGID" --clear-groups "$@"
|