From ebc8da5779880478c7cd6fe135d9788f28368155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Stefa=C5=84czyk?= Date: Mon, 18 Apr 2022 16:05:49 +0200 Subject: [PATCH 1/4] Fix alpine incompatibility --- bin/mc-send-to-console | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/mc-send-to-console b/bin/mc-send-to-console index 91ae0b65046..52049056922 100755 --- a/bin/mc-send-to-console +++ b/bin/mc-send-to-console @@ -12,8 +12,13 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then exit 1 fi +distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g') if [ "$(id -u)" = 0 ]; then - gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'" + if [[ $distro == 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 \ No newline at end of file + echo "$@" >"${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}" +fi From 378d63b6f307b8ca2fa907ba7baaa7349f859806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Stefa=C5=84czyk?= Date: Mon, 18 Apr 2022 16:27:02 +0200 Subject: [PATCH 2/4] Use global variable instead creating own --- bin/mc-send-to-console | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/mc-send-to-console b/bin/mc-send-to-console index 52049056922..fe174aedf3e 100755 --- a/bin/mc-send-to-console +++ b/bin/mc-send-to-console @@ -12,7 +12,6 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then exit 1 fi -distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g') if [ "$(id -u)" = 0 ]; then if [[ $distro == alpine ]]; then exec su-exec minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'" From 3cd70ec4e00aa1a8183643a39dbacfdcc2232bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Stefa=C5=84czyk?= Date: Mon, 18 Apr 2022 17:01:37 +0200 Subject: [PATCH 3/4] Use function from start-utils to fetch distro name --- bin/mc-send-to-console | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mc-send-to-console b/bin/mc-send-to-console index fe174aedf3e..7bf1b7761dd 100755 --- a/bin/mc-send-to-console +++ b/bin/mc-send-to-console @@ -1,5 +1,5 @@ #!/bin/bash - +. "/start-utils" : "${CONSOLE_IN_NAMED_PIPE:=/tmp/minecraft-console-in}" if [ $# = 0 ]; then @@ -13,7 +13,7 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then fi if [ "$(id -u)" = 0 ]; then - if [[ $distro == alpine ]]; 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}'" From f63cc57ec5ebe5fa39a22a45a95ea0162fa55651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Stefa=C5=84czyk?= Date: Mon, 18 Apr 2022 17:11:19 +0200 Subject: [PATCH 4/4] Final fix for alpine incompatibility --- bin/mc-send-to-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mc-send-to-console b/bin/mc-send-to-console index 7bf1b7761dd..c1a76b4a05b 100755 --- a/bin/mc-send-to-console +++ b/bin/mc-send-to-console @@ -13,7 +13,7 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then fi if [ "$(id -u)" = 0 ]; then - if [[ getDistro == alpine ]]; 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}'"