diff --git a/alpine/entrypoint.sh b/alpine/entrypoint.sh index f2f559f..7cf5f0f 100644 --- a/alpine/entrypoint.sh +++ b/alpine/entrypoint.sh @@ -33,11 +33,13 @@ export INTERNAL_IP # Switch to the container's working directory cd /home/container || exit 1 -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/games/fivem/entrypoint.sh b/games/fivem/entrypoint.sh index f2f559f..814aad7 100644 --- a/games/fivem/entrypoint.sh +++ b/games/fivem/entrypoint.sh @@ -33,11 +33,12 @@ export INTERNAL_IP # Switch to the container's working directory cd /home/container || exit 1 -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" - -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/games/source/entrypoint.sh b/games/source/entrypoint.sh index ebeb20a..2438d78 100644 --- a/games/source/entrypoint.sh +++ b/games/source/entrypoint.sh @@ -33,10 +33,12 @@ export INTERNAL_IP # Switch to the container's working directory cd /home/container || exit 1 -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/go/entrypoint.sh b/go/entrypoint.sh index 11e9cc9..e64cfd6 100644 --- a/go/entrypoint.sh +++ b/go/entrypoint.sh @@ -36,10 +36,12 @@ cd /home/container || exit 1 # Print Go version go version -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/java/entrypoint.sh b/java/entrypoint.sh index 4511dab..1d3de7b 100644 --- a/java/entrypoint.sh +++ b/java/entrypoint.sh @@ -36,10 +36,12 @@ cd /home/container || exit 1 # Print Java version java -version -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/java/test.sh b/java/test.sh new file mode 100644 index 0000000..8660c31 --- /dev/null +++ b/java/test.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +STARTUP="./foo.sh -env {{HOME}}" + +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") + +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED" diff --git a/nodejs/entrypoint.sh b/nodejs/entrypoint.sh index d5f2a28..b4f4bbf 100644 --- a/nodejs/entrypoint.sh +++ b/nodejs/entrypoint.sh @@ -36,10 +36,12 @@ cd /home/container || exit 1 # Print Node.js version node -v -# Replace variables in the startup command -MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") -printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") -# Run the startup command -exec env "${MODIFIED_STARTUP}" +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +exec env "$PARSED"