2017-05-20 09:12:29 -04:00
|
|
|
#!/bin/sh
|
2017-05-20 14:01:05 -04:00
|
|
|
|
|
|
|
### 1. Adds local user (UID and GID are provided from environment variables).
|
|
|
|
### 2. Updates permissions, except for ./public/system (should be chown on previous installations).
|
|
|
|
### 3. Executes the command as that user.
|
|
|
|
|
|
|
|
echo "Creating mastodon user (UID : ${UID} and GID : ${GID})..."
|
2017-05-20 09:12:29 -04:00
|
|
|
addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon
|
2017-05-20 14:01:05 -04:00
|
|
|
|
|
|
|
echo "Updating permissions..."
|
2017-05-20 09:12:29 -04:00
|
|
|
find /mastodon -path /mastodon/public/system -prune -o -not -user mastodon -not -group mastodon -print0 | xargs -0 chown -f mastodon:mastodon
|
2017-05-20 14:01:05 -04:00
|
|
|
|
|
|
|
echo "Executing process..."
|
2017-12-21 19:07:02 -05:00
|
|
|
LD_PRELOAD=/lib/stack-fix.so exec su-exec mastodon:mastodon /sbin/tini -- "$@"
|