mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
23 lines
649 B
Bash
Executable file
23 lines
649 B
Bash
Executable file
#!/bin/bash
|
|
. "/start-utils"
|
|
: "${CONSOLE_IN_NAMED_PIPE:=/tmp/minecraft-console-in}"
|
|
|
|
if [ $# = 0 ]; then
|
|
echo "ERROR: pass console commands as arguments"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
|
|
echo "ERROR: named pipe ${CONSOLE_IN_NAMED_PIPE} is missing"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(id -u)" = 0 ]; then
|
|
if [[ $(getDistro) == alpine ]]; then
|
|
exec su-exec minecraft bash -c "echo '$*' > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
|
|
else
|
|
exec gosu minecraft bash -c "echo '$*' > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
|
|
fi
|
|
else
|
|
echo "$@" >"${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
|
|
fi
|