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

23 lines
515 B
Bash
Raw Normal View History

2016-02-27 23:10:11 +00:00
#!/bin/sh
set -e
sed -i "/^minecraft/s/:1000:1000:/:${UID}:${GID}:/g" /etc/passwd
sed -i "/^minecraft/s/:1000:/:${GID}:/g" /etc/group
2016-02-27 23:10:11 +00:00
if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
fix_ownership() {
dir=$1
2016-12-06 22:31:06 +00:00
if ! su-exec 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
fi
echo "Switching to user 'minecraft'"
2016-12-06 22:31:06 +00:00
su-exec minecraft /start-minecraft $@