docker-minecraft-server/minecraft-server/start

24 lines
620 B
Plaintext
Raw Normal View History

2017-11-01 05:42:44 +00:00
#!/bin/sh
set -e
# Since Alpine doesn't have a usermod command we have to directly manipulate the passwd/group files :(
sed -i "/^minecraft/s/:1000:1000:/:${UID}:${GID}:/" /etc/passwd
sed -i "/^minecraft/s/:1000:/:${GID}:/" /etc/group
2017-11-01 05:42:44 +00:00
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
fix_ownership() {
dir=$1
if ! su-exec 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'"
su-exec minecraft /start-configuration $@