diff --git a/bot/bastion/entrypoint.sh b/bot/bastion/entrypoint.sh index 06c0ce9..d5bdcc7 100644 --- a/bot/bastion/entrypoint.sh +++ b/bot/bastion/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')) diff --git a/bot/parkertron/entrypoint.sh b/bot/parkertron/entrypoint.sh index c39e96c..1971986 100644 --- a/bot/parkertron/entrypoint.sh +++ b/bot/parkertron/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/ash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` diff --git a/bot/red/entrypoint.sh b/bot/red/entrypoint.sh index cdb1fd1..d5bdcc7 100644 --- a/bot/red/entrypoint.sh +++ b/bot/red/entrypoint.sh @@ -1,12 +1,13 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')) echo -e ":/home/container$ ${MODIFIED_STARTUP}" # Run the Server -eval ${MODIFIED_STARTUP} \ No newline at end of file +eval ${MODIFIED_STARTUP} diff --git a/bot/sinusbot/entrypoint.sh b/bot/sinusbot/entrypoint.sh index 33e5ddc..d0aea75 100644 --- a/bot/sinusbot/entrypoint.sh +++ b/bot/sinusbot/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` diff --git a/cassandra/entrypoint.sh b/cassandra/entrypoint.sh index 3df1092..2541719 100644 --- a/cassandra/entrypoint.sh +++ b/cassandra/entrypoint.sh @@ -5,7 +5,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/dotnet/entrypoint.sh b/dotnet/entrypoint.sh index 13d9e20..11acd70 100644 --- a/dotnet/entrypoint.sh +++ b/dotnet/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') diff --git a/erlang/entrypoint.sh b/erlang/entrypoint.sh index 6875d24..7511c57 100644 --- a/erlang/entrypoint.sh +++ b/erlang/entrypoint.sh @@ -3,7 +3,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/games/altv/entrypoint.sh b/games/altv/entrypoint.sh index d9f5b44..11acd70 100644 --- a/games/altv/entrypoint.sh +++ b/games/altv/entrypoint.sh @@ -1,12 +1,13 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') echo -e ":/home/container$ ${MODIFIED_STARTUP}" # Run the Server -eval ${MODIFIED_STARTUP} \ No newline at end of file +eval ${MODIFIED_STARTUP} diff --git a/games/arma3/entrypoint.sh b/games/arma3/entrypoint.sh index 31b19fd..d01b9a4 100644 --- a/games/arma3/entrypoint.sh +++ b/games/arma3/entrypoint.sh @@ -33,24 +33,24 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id] if [[ -f "${STEAMCMD_LOG}" ]]; then rm -f "${STEAMCMD_LOG:?}" fi - + updateAttempt=0 while (( $updateAttempt < $STEAMCMD_ATTEMPTS )); do # Loop for specified number of attempts # Increment attempt counter updateAttempt=$((updateAttempt+1)) - + if (( $updateAttempt > 1 )); then # Notify if not first attempt echo -e "\t${YELLOW}Re-Attempting download/update in 3 seconds...${NC} (Attempt ${CYAN}${updateAttempt}${NC} of ${CYAN}${STEAMCMD_ATTEMPTS}${NC})\n" sleep 3 fi - + # Check if updating server or mod if [[ $1 == 0 ]]; then # Server ${STEAMCMD_DIR}/steamcmd.sh +force_install_dir /home/container "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +app_update $2 $extraFlags $validateServer +quit | tee -a "${STEAMCMD_LOG}" else # Mod ${STEAMCMD_DIR}/steamcmd.sh "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +workshop_download_item $GAME_ID $2 +quit | tee -a "${STEAMCMD_LOG}" fi - + # Error checking for SteamCMD steamcmdExitCode=${PIPESTATUS[0]} if [[ -n $(grep -i "error\|failed" "${STEAMCMD_LOG}" | grep -iv "setlocal\|SDL") ]]; then # Catch errors (ignore setlocale and SDL warnings) @@ -166,6 +166,11 @@ function RemoveDuplicates { #[Input: str - Output: printf of new str] } # === ENTRYPOINT START === + +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP + cd /home/container sleep 1 @@ -213,17 +218,17 @@ allMods=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array if [[ ${UPDATE_SERVER} == 1 ]]; then echo -e "\n${GREEN}[STARTUP]: ${CYAN}Starting checks for all updates...${NC}" echo -e "(It is okay to ignore any \"SDL\" errors during this process)\n" - + ## Update game server echo -e "${GREEN}[UPDATE]:${NC} Checking for game server updates with App ID: ${CYAN}${STEAMCMD_APPID}${NC}..." - + if [[ ${VALIDATE_SERVER} == 1 ]]; then # Validate will be added as a parameter if specified echo -e "\t${CYAN}File validation enabled.${NC} (This may take extra time to complete)" validateServer="validate" else validateServer="" fi - + # Determine what extra flags should be set if [[ -n ${STEAMCMD_EXTRA_FLAGS} ]]; then echo -e "\t(${YELLOW}Advanced${NC}) Extra SteamCMD flags specified: ${CYAN}${STEAMCMD_EXTRA_FLAGS}${NC}\n" @@ -235,9 +240,9 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then echo -e "" extraFlags="" fi - + RunSteamCMD 0 ${STEAMCMD_APPID} - + ## Update mods if [[ -n $allMods ]] && [[ ${DISABLE_MOD_UPDATES} != 1 ]]; then echo -e "\n${GREEN}[UPDATE]:${NC} Checking all ${CYAN}Steam Workshop mods${NC} for updates..." @@ -274,7 +279,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then echo -e "\tMod was last updated: ${CYAN}$(date -d @${latestUpdate})${NC}" fi echo -e "\tAttempting mod update/download via SteamCMD...\n" - + RunSteamCMD $modType $modID fi fi @@ -298,7 +303,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then if [[ "${CLIENT_MODS}" != *"@${modID};"* ]]; then echo -e "\tKey file and directory for unconfigured optional mod ${CYAN}${modID}${NC} is being deleted..." fi - + # Delete the optional mod .bikey file and directory rm ${keyFile} rmdir ./@${modID}_optional 2> /dev/null diff --git a/games/source/entrypoint.sh b/games/source/entrypoint.sh index f2f2744..8f43bc9 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 ab6fbe7..7adafec 100644 --- a/go/entrypoint.sh +++ b/go/entrypoint.sh @@ -20,14 +20,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# +# # Default the TZ environment variable to UTC. 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 b6d29da..e92f3d3 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/mariadb/entrypoint.sh b/mariadb/entrypoint.sh index cd80a9a..d3884d4 100644 --- a/mariadb/entrypoint.sh +++ b/mariadb/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') diff --git a/mongodb/entrypoint.sh b/mongodb/entrypoint.sh index cd80a9a..d3884d4 100644 --- a/mongodb/entrypoint.sh +++ b/mongodb/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') diff --git a/mono/entrypoint.sh b/mono/entrypoint.sh index ef6ae2e..fe2d5f6 100644 --- a/mono/entrypoint.sh +++ b/mono/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP="eval $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')" diff --git a/nodejs/entrypoint.sh b/nodejs/entrypoint.sh index 440c2bf..60c2279 100644 --- a/nodejs/entrypoint.sh +++ b/nodejs/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Print Node.js Version node -v diff --git a/oses/alpine/entrypoint.sh b/oses/alpine/entrypoint.sh index 5b4ce5f..e156de6 100644 --- a/oses/alpine/entrypoint.sh +++ b/oses/alpine/entrypoint.sh @@ -18,14 +18,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# +# # Default the TZ environment variable to UTC. 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 9a5cab5..461e6b9 100644 --- a/oses/debian/entrypoint.sh +++ b/oses/debian/entrypoint.sh @@ -1,12 +1,13 @@ #!/bin/bash cd /home/container -# Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Make internal Docker IP address available to processes. +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') echo -e ":/home/container$ ${MODIFIED_STARTUP}" # Run the Server -eval ${MODIFIED_STARTUP} \ No newline at end of file +eval ${MODIFIED_STARTUP} diff --git a/oses/ubuntu/entrypoint.sh b/oses/ubuntu/entrypoint.sh index d9f5b44..461e6b9 100644 --- a/oses/ubuntu/entrypoint.sh +++ b/oses/ubuntu/entrypoint.sh @@ -2,11 +2,12 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') echo -e ":/home/container$ ${MODIFIED_STARTUP}" # Run the Server -eval ${MODIFIED_STARTUP} \ No newline at end of file +eval ${MODIFIED_STARTUP} diff --git a/postgres/entrypoint.sh b/postgres/entrypoint.sh index 0a72c42..53b47f4 100644 --- a/postgres/entrypoint.sh +++ b/postgres/entrypoint.sh @@ -5,7 +5,8 @@ cd /home/container postgres --version # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` diff --git a/python/entrypoint.sh b/python/entrypoint.sh index 0a7b93d..aab4aea 100644 --- a/python/entrypoint.sh +++ b/python/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Print current Python version python --version diff --git a/redis/entrypoint.sh b/redis/entrypoint.sh index e0ae99e..6e19f17 100644 --- a/redis/entrypoint.sh +++ b/redis/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') diff --git a/rust/entrypoint.sh b/rust/entrypoint.sh index ed8bce1..c865f6c 100644 --- a/rust/entrypoint.sh +++ b/rust/entrypoint.sh @@ -2,7 +2,8 @@ cd /home/container # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP # Print current Rust version cargo --version diff --git a/voice/teaspeak/entrypoint.sh b/voice/teaspeak/entrypoint.sh index 49123df..9b0d21f 100644 --- a/voice/teaspeak/entrypoint.sh +++ b/voice/teaspeak/entrypoint.sh @@ -3,7 +3,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/wine/entrypoint.sh b/wine/entrypoint.sh index 3ee92c7..be33420 100644 --- a/wine/entrypoint.sh +++ b/wine/entrypoint.sh @@ -7,7 +7,8 @@ echo "Current timezone: $(cat /etc/timezone)" wine --version # Make internal Docker IP address available to processes. -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP ## just in case someone removed the defaults. if [ "${STEAM_USER}" == "" ]; then