From 42d51aa044fd5f714ffe77fd32e8ba349fa2fdfd Mon Sep 17 00:00:00 2001 From: Luis Vera Date: Wed, 30 Mar 2022 10:40:27 -0500 Subject: [PATCH] fix: invalid INTERNAL_IP environment value (#24) New IP output appends UID to the result, causing the value to be set to that instead of the IP. Fix it by ignoring the last two appended UID results --- games/rust/entrypoint.sh | 2 +- games/source/entrypoint.sh | 2 +- go/entrypoint.sh | 2 +- java/entrypoint.sh | 2 +- nodejs/entrypoint.sh | 2 +- oses/alpine/entrypoint.sh | 2 +- oses/debian/entrypoint.sh | 2 +- python/entrypoint.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/games/rust/entrypoint.sh b/games/rust/entrypoint.sh index 2780d41..16c6cab 100644 --- a/games/rust/entrypoint.sh +++ b/games/rust/entrypoint.sh @@ -2,7 +2,7 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +export INTERNAL_IP=`ip route get 1 | awk '{print $(NF-2);exit}'` # Update Rust Server ./steamcmd/steamcmd.sh +force_install_dir /home/container +login anonymous +app_update 258550 +quit diff --git a/games/source/entrypoint.sh b/games/source/entrypoint.sh index 6830b8d..ae6363c 100644 --- a/games/source/entrypoint.sh +++ b/games/source/entrypoint.sh @@ -30,7 +30,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/go/entrypoint.sh b/go/entrypoint.sh index 3e7121a..7adafec 100644 --- a/go/entrypoint.sh +++ b/go/entrypoint.sh @@ -27,7 +27,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/java/entrypoint.sh b/java/entrypoint.sh index 012d126..a081cc4 100644 --- a/java/entrypoint.sh +++ b/java/entrypoint.sh @@ -27,7 +27,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/nodejs/entrypoint.sh b/nodejs/entrypoint.sh index 7904c58..d96f46c 100644 --- a/nodejs/entrypoint.sh +++ b/nodejs/entrypoint.sh @@ -27,7 +27,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/oses/alpine/entrypoint.sh b/oses/alpine/entrypoint.sh index 98c51d4..e156de6 100644 --- a/oses/alpine/entrypoint.sh +++ b/oses/alpine/entrypoint.sh @@ -25,7 +25,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/oses/debian/entrypoint.sh b/oses/debian/entrypoint.sh index 7fecb8b..4637742 100644 --- a/oses/debian/entrypoint.sh +++ b/oses/debian/entrypoint.sh @@ -26,7 +26,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory diff --git a/python/entrypoint.sh b/python/entrypoint.sh index 8f009ee..ea252e5 100644 --- a/python/entrypoint.sh +++ b/python/entrypoint.sh @@ -27,7 +27,7 @@ TZ=${TZ:-UTC} export TZ # Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP # Switch to the container's working directory