mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 13:52:27 +00:00
8101c8b51c
Renamed to start-deployFTBA # Conflicts: # start-configuration # start-deployCF
46 lines
995 B
Bash
46 lines
995 B
Bash
#!/bin/bash
|
|
|
|
. ${SCRIPTS:-/}start-utils
|
|
|
|
umask 0002
|
|
chmod g+w /data
|
|
|
|
if [ $(id -u) = 0 ]; then
|
|
runAsUser=minecraft
|
|
runAsGroup=minecraft
|
|
|
|
if [[ -v UID ]]; then
|
|
if [[ $UID != 0 ]]; then
|
|
if [[ $UID != $(id -u minecraft) ]]; then
|
|
log "Changing uid of minecraft to $UID"
|
|
usermod -u $UID minecraft
|
|
fi
|
|
else
|
|
runAsUser=root
|
|
fi
|
|
fi
|
|
|
|
if [[ -v GID ]]; then
|
|
if [[ $GID != 0 ]]; then
|
|
if [[ $GID != $(id -g minecraft) ]]; then
|
|
log "Changing gid of minecraft to $GID"
|
|
groupmod -o -g $GID minecraft
|
|
fi
|
|
else
|
|
runAsGroup=root
|
|
fi
|
|
fi
|
|
|
|
if [[ $(stat -c "%u" /data) != $UID ]]; then
|
|
log "Changing ownership of /data to $UID ..."
|
|
chown -R ${runAsUser}:${runAsGroup} /data
|
|
fi
|
|
|
|
if [[ ${SKIP_NSSWITCH_CONF^^} != TRUE ]]; then
|
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
|
fi
|
|
|
|
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
|
else
|
|
exec ${SCRIPTS:-/}start-configuration $@
|
|
fi
|