Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix alpine incompatibility #1481

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions bin/mc-send-to-console
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

. "/start-utils"
: "${CONSOLE_IN_NAMED_PIPE:=/tmp/minecraft-console-in}"

if [ $# = 0 ]; then
Expand All @@ -13,7 +13,11 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
fi

if [ "$(id -u)" = 0 ]; then
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
if [[ getDistro == alpine ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will need to be the following to actually run the function and not be a bare string "getDistro", which will never equal "alpine":

Suggested change
if [[ getDistro == alpine ]]; then
if [[ $(getDistro) == alpine ]]; then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, again I have tested with wrong command zsh suggested me and ran build without args 🤦 Commit fixing it is there.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally understand. I am grateful that IntelliJ makes it easy for me to switch between build types:

image

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
echo "$@" >"${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
fi