2017-05-20 14:12:29 +01:00
|
|
|
#!/bin/sh
|
2017-05-20 19:01:05 +01: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 14:12:29 +01:00
|
|
|
addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon
|
2017-05-20 19:01:05 +01:00
|
|
|
|
|
|
|
echo "Updating permissions..."
|
2017-05-20 14:12:29 +01: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 19:01:05 +01:00
|
|
|
|
|
|
|
echo "Executing process..."
|
2017-12-22 00:07:02 +00:00
|
|
|
LD_PRELOAD=/lib/stack-fix.so exec su-exec mastodon:mastodon /sbin/tini -- "$@"
|