docker-minecraft-server/minecraft-server/start.sh

21 lines
399 B
Bash
Raw Normal View History

2016-02-27 23:10:11 +00:00
#!/bin/sh
set -e
usermod --uid $UID minecraft
groupmod --gid $GID minecraft
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
}
2016-02-27 23:10:11 +00:00
fix_ownership /data
fix_ownership /home/minecraft
echo "Switching to user 'minecraft'"
exec sudo -E -u minecraft /start-minecraft "$@"