mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
b5bcea7d61
For #104
23 lines
467 B
Bash
Executable File
23 lines
467 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
usermod --uid $UID minecraft
|
|
groupmod --gid $GID minecraft
|
|
|
|
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
|
|
fix_ownership() {
|
|
dir=$1
|
|
if ! sudo -u minecraft test -w $dir; then
|
|
echo "Correcting writability of $dir ..."
|
|
chown -R minecraft:minecraft $dir
|
|
chmod -R u+w $dir
|
|
fi
|
|
}
|
|
|
|
fix_ownership /data
|
|
fix_ownership /home/minecraft
|
|
fi
|
|
|
|
echo "Switching to user 'minecraft'"
|
|
exec sudo -E -u minecraft /start-minecraft "$@"
|