mirror of
https://github.com/darksaid98/yolks.git
synced 2026-12-01 14:38:59 +00:00
style: format shell scripts
This commit is contained in:
23 files changed
+355
-371
No files matched your search
@@ -30,7 +30,10 @@ echo -e "${YELLOW}:/home/container${NC} ${MODIFIED_STARTUP}"
|
||||
echo -e "${BLUE}-------------------------------------------------${NC}"
|
||||
echo -e "${YELLOW}starting MongoDB...${NC}"
|
||||
echo -e "${BLUE}-------------------------------------------------${NC}"
|
||||
mongod --fork --dbpath /home/container/mongodb/ --port 27017 --logpath /home/container/mongod.log --logRotate reopen --logappend && until nc -z -v -w5 127.0.0.1 27017; do echo 'Waiting for mongodb connection...'; sleep 5; done
|
||||
mongod --fork --dbpath /home/container/mongodb/ --port 27017 --logpath /home/container/mongod.log --logRotate reopen --logappend && until nc -z -v -w5 127.0.0.1 27017; do
|
||||
echo 'Waiting for mongodb connection...'
|
||||
sleep 5
|
||||
done
|
||||
|
||||
# Run the Server
|
||||
echo -e "${BLUE}-------------------------------------------------${NC}"
|
||||
|
||||
@@ -6,7 +6,7 @@ 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')`
|
||||
MODIFIED_STARTUP=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
|
||||
@@ -5,9 +5,8 @@ cd /home/container
|
||||
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')`
|
||||
MODIFIED_STARTUP=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
|
||||
+2
-3
@@ -2,12 +2,11 @@
|
||||
cd /home/container
|
||||
|
||||
# Make internal Docker IP address available to processes.
|
||||
export INTERNAL_IP=`ip route get 1 | awk '{print $(NF-2);exit}'`
|
||||
|
||||
export INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||
|
||||
# Replace Startup Variables
|
||||
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
|
||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
eval ${MODIFIED_STARTUP}
|
||||
eval ${MODIFIED_STARTUP}
|
||||
@@ -15,15 +15,13 @@ cd /home/container || exit 1
|
||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mjava -version\n"
|
||||
java -version
|
||||
|
||||
|
||||
# Print Python version
|
||||
if command -v python &> /dev/null
|
||||
then
|
||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython --version\n"
|
||||
python --version
|
||||
if command -v python &>/dev/null; then
|
||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython --version\n"
|
||||
python --version
|
||||
else
|
||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython3 --version\n"
|
||||
python3 --version
|
||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython3 --version\n"
|
||||
python3 --version
|
||||
fi
|
||||
|
||||
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell
|
||||
|
||||
@@ -22,7 +22,7 @@ if [ "${GIT_ENABLED}" == "false" ] || [ "${GIT_ENABLED}" == "0" ]; then
|
||||
GIT_ADDRESS="https://${GIT_USERNAME}:${GIT_ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||
fi
|
||||
|
||||
# Update
|
||||
# Update
|
||||
if [ "$(ls -A /home/container)" ]; then
|
||||
echo -e "/home/container directory is not empty."
|
||||
|
||||
@@ -42,7 +42,7 @@ if [ "${GIT_ENABLED}" == "false" ] || [ "${GIT_ENABLED}" == "0" ]; then
|
||||
# If git origin matches the repo specified by user then pull
|
||||
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||
echo "Pulling changes from Git."
|
||||
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||
fi
|
||||
else
|
||||
# No files exist in resources folder, clone
|
||||
@@ -57,7 +57,7 @@ if [ "${GIT_ENABLED}" == "false" ] || [ "${GIT_ENABLED}" == "0" ]; then
|
||||
fi
|
||||
else
|
||||
echo -e "Using Git is disabled."
|
||||
fi
|
||||
fi
|
||||
|
||||
# set this variable, dotnet needs it even without it it reports to `dotnet --info` it can not start any aplication without this
|
||||
export DOTNET_ROOT=/usr/share/
|
||||
|
||||
+31
-38
@@ -7,11 +7,11 @@
|
||||
## License: MIT License
|
||||
|
||||
## === CONSTANTS ===
|
||||
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
|
||||
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
|
||||
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD
|
||||
GAME_ID=107410 # SteamCMD ID for the Arma 3 GAME (not server). Only used for Workshop mod downloads.
|
||||
EGG_URL='https://github.com/darksaid98/eggs/tree/master/game_eggs/steamcmd_servers/arma/arma3' # URL for Pterodactyl Egg & Info (only used as info to legacy users)
|
||||
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
|
||||
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
|
||||
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD
|
||||
GAME_ID=107410 # SteamCMD ID for the Arma 3 GAME (not server). Only used for Workshop mod downloads.
|
||||
EGG_URL='https://github.com/darksaid98/eggs/tree/master/game_eggs/steamcmd_servers/arma/arma3' # URL for Pterodactyl Egg & Info (only used as info to legacy users)
|
||||
|
||||
# Color Codes
|
||||
CYAN='\033[0;36m'
|
||||
@@ -36,11 +36,11 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
|
||||
fi
|
||||
|
||||
updateAttempt=0
|
||||
while (( $updateAttempt < $STEAMCMD_ATTEMPTS )); do # Loop for specified number of attempts
|
||||
while (($updateAttempt < $STEAMCMD_ATTEMPTS)); do # Loop for specified number of attempts
|
||||
# Increment attempt counter
|
||||
updateAttempt=$((updateAttempt+1))
|
||||
updateAttempt=$((updateAttempt + 1))
|
||||
|
||||
if (( $updateAttempt > 1 )); then # Notify if not first attempt
|
||||
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
|
||||
@@ -103,7 +103,7 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
|
||||
echo -e "\t${YELLOW}(Please contact your administrator/host for support)${NC}\n"
|
||||
cp -r /tmp/dumps /home/container/dumps
|
||||
exit $steamcmdExitCode
|
||||
else # Success!
|
||||
else # Success!
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}"
|
||||
else # Mod
|
||||
@@ -125,7 +125,7 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
|
||||
|
||||
cp $file ./keys/optional_$2_${filename}
|
||||
|
||||
done;
|
||||
done
|
||||
|
||||
echo -e "\tMod with ID $2 is an optional mod. Deleting original mod download folder..."
|
||||
rm -r ./@$2
|
||||
@@ -137,8 +137,8 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if (( $updateAttempt == $STEAMCMD_ATTEMPTS )); then # Notify if failed last attempt
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
if (($updateAttempt == $STEAMCMD_ATTEMPTS)); then # Notify if failed last attempt
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
echo -e "\t${RED}Final attempt made! ${YELLOW}Unable to complete game server update. ${CYAN}Skipping...${NC}"
|
||||
echo -e "\t(Please try again at a later time)"
|
||||
sleep 3
|
||||
@@ -154,11 +154,9 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
|
||||
# Takes a directory (string) as input, and recursively makes all files & folders lowercase.
|
||||
function ModsLowercase {
|
||||
echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..."
|
||||
for SRC in `find ./$1 -depth`
|
||||
do
|
||||
DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
|
||||
if [ "${SRC}" != "${DST}" ]
|
||||
then
|
||||
for SRC in $(find ./$1 -depth); do
|
||||
DST=$(dirname "${SRC}")/$(basename "${SRC}" | tr '[A-Z]' '[a-z]')
|
||||
if [ "${SRC}" != "${DST}" ]; then
|
||||
[ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}"
|
||||
fi
|
||||
done
|
||||
@@ -166,7 +164,7 @@ function ModsLowercase {
|
||||
|
||||
# Removes duplicate items from a semicolon delimited string
|
||||
function RemoveDuplicates { #[Input: str - Output: printf of new str]
|
||||
if [[ -n $1 ]]; then # If nothing to compare, skip to prevent extra semicolon being returned
|
||||
if [[ -n $1 ]]; then # If nothing to compare, skip to prevent extra semicolon being returned
|
||||
echo $1 | sed -e 's/;/\n/g' | sort -u | xargs printf '%s;'
|
||||
fi
|
||||
}
|
||||
@@ -218,10 +216,10 @@ if [[ -n ${OPTIONALMODS} ]] && [[ ${OPTIONALMODS} != *\; ]]; then # Add specifie
|
||||
else
|
||||
allMods+=${OPTIONALMODS}
|
||||
fi
|
||||
allMods+=$CLIENT_MODS # Add all client-side mods to the master mod list
|
||||
allMods+=$CLIENT_MODS # Add all client-side mods to the master mod list
|
||||
CLIENT_MODS=$(RemoveDuplicates ${CLIENT_MODS}) # Remove duplicate mods from CLIENT_MODS, if present
|
||||
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, if present
|
||||
allMods=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
|
||||
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, if present
|
||||
allMods=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
|
||||
|
||||
# Update everything (server and mods), if specified
|
||||
if [[ ${UPDATE_SERVER} == 1 ]]; then
|
||||
@@ -255,8 +253,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
|
||||
## 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..."
|
||||
for modID in $(echo $allMods | sed -e 's/@//g')
|
||||
do
|
||||
for modID in $(echo $allMods | sed -e 's/@//g'); do
|
||||
if [[ $modID =~ ^[0-9]+$ ]]; then # Only check mods that are in ID-form
|
||||
# If a mod is defined in OPTIONALMODS, and is not defined in CLIENT_MODS or SERVERMODS, then treat as an optional mod
|
||||
# Optional mods are given a different directory which is checked to see if a new update is available. This is to ensure
|
||||
@@ -273,7 +270,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
|
||||
latestUpdate=$(curl -sL https://steamcommunity.com/sharedfiles/filedetails/changelog/$modID | grep '<p id=' | head -1 | cut -d'"' -f2)
|
||||
|
||||
# If the update time is valid and newer than the local directory's creation date, or the mod hasn't been downloaded yet, download the mod
|
||||
if [[ ! -d $modDir ]] || [[ ( -n $latestUpdate ) && ( $latestUpdate =~ ^[0-9]+$ ) && ( $latestUpdate > $(find $modDir | head -1 | xargs stat -c%Y) ) ]]; then
|
||||
if [[ ! -d $modDir ]] || [[ (-n $latestUpdate) && ($latestUpdate =~ ^[0-9]+$) && ($latestUpdate > $(find $modDir | head -1 | xargs stat -c%Y)) ]]; then
|
||||
# Get the mod's name from the Workshop page as well
|
||||
modName=$(curl -sL https://steamcommunity.com/sharedfiles/filedetails/changelog/$modID | grep 'workshopItemTitle' | cut -d'>' -f2 | cut -d'<' -f1)
|
||||
if [[ -z $modName ]]; then # Set default name if unavailable
|
||||
@@ -319,10 +316,10 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
|
||||
|
||||
# Delete the optional mod .bikey file and directory
|
||||
rm ${keyFile}
|
||||
rmdir ./@${modID}_optional 2> /dev/null
|
||||
rmdir ./@${modID}_optional 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
done;
|
||||
done
|
||||
|
||||
echo -e "${GREEN}[UPDATE]:${NC} Steam Workshop mod update check ${GREEN}complete${NC}!"
|
||||
fi
|
||||
@@ -340,8 +337,7 @@ fi
|
||||
|
||||
# Make mods lowercase, if specified
|
||||
if [[ ${MODS_LOWERCASE} == "1" ]]; then
|
||||
for modDir in $allMods
|
||||
do
|
||||
for modDir in $allMods; do
|
||||
ModsLowercase $modDir
|
||||
done
|
||||
fi
|
||||
@@ -355,8 +351,7 @@ mkdir -p /home/container/serverprofile/rpt
|
||||
# Clear HC cache, if specified
|
||||
if [[ ${CLEAR_CACHE} == "1" ]]; then
|
||||
echo -e "\n${GREEN}[STARTUP]: ${CYAN}Clearing Headless Client profiles cache...${NC}"
|
||||
for profileDir in ./serverprofile/home/*
|
||||
do
|
||||
for profileDir in ./serverprofile/home/*; do
|
||||
[ "$profileDir" = "./serverprofile/home/Player" ] && continue
|
||||
rm -rf $profileDir
|
||||
done
|
||||
@@ -372,7 +367,7 @@ fi
|
||||
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
|
||||
export USER_ID=$(id -u)
|
||||
export GROUP_ID=$(id -g)
|
||||
envsubst < /passwd.template > ${NSS_WRAPPER_PASSWD}
|
||||
envsubst </passwd.template >${NSS_WRAPPER_PASSWD}
|
||||
|
||||
if [[ ${SERVER_BINARY} == *"x64"* ]]; then # Check which libnss-wrapper architecture to run, based off the server binary name
|
||||
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
|
||||
@@ -381,16 +376,14 @@ else
|
||||
fi
|
||||
|
||||
# Replace Startup Variables
|
||||
modifiedStartup=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
||||
modifiedStartup=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
|
||||
# Start Headless Clients if applicable
|
||||
if [[ ${HC_NUM} > 0 ]]; then
|
||||
echo -e "\n${GREEN}[STARTUP]:${NC} Starting ${CYAN}${HC_NUM}${NC} Headless Client(s)."
|
||||
for i in $(seq ${HC_NUM})
|
||||
do
|
||||
if [[ ${HC_HIDE} == "1" ]];
|
||||
then
|
||||
./${SERVER_BINARY} -client -connect=127.0.0.1 -port=${SERVER_PORT} -password="${SERVER_PASSWORD}" -profiles=./serverprofile -bepath=./battleye -mod="${CLIENT_MODS}" ${STARTUP_PARAMS} > /dev/null 2>&1 &
|
||||
for i in $(seq ${HC_NUM}); do
|
||||
if [[ ${HC_HIDE} == "1" ]]; then
|
||||
./${SERVER_BINARY} -client -connect=127.0.0.1 -port=${SERVER_PORT} -password="${SERVER_PASSWORD}" -profiles=./serverprofile -bepath=./battleye -mod="${CLIENT_MODS}" ${STARTUP_PARAMS} >/dev/null 2>&1 &
|
||||
else
|
||||
./${SERVER_BINARY} -client -connect=127.0.0.1 -port=${SERVER_PORT} -password="${SERVER_PASSWORD}" -profiles=./serverprofile -bepath=./battleye -mod="${CLIENT_MODS}" ${STARTUP_PARAMS} &
|
||||
fi
|
||||
@@ -402,7 +395,7 @@ fi
|
||||
echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:"
|
||||
echo -e "${CYAN}${modifiedStartup}${NC}\n"
|
||||
if [[ "$STARTUP_PARAMS" == *"-noLogs"* ]]; then
|
||||
${modifiedStartup}
|
||||
${modifiedStartup}
|
||||
else
|
||||
${modifiedStartup} 2>&1 | tee -a "$LOG_FILE"
|
||||
fi
|
||||
|
||||
+32
-36
@@ -7,10 +7,10 @@
|
||||
## License: MIT License
|
||||
|
||||
## === CONSTANTS ===
|
||||
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
|
||||
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
|
||||
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD
|
||||
GAME_ID=221100 # SteamCMD ID for the DayZ GAME (not server). Only used for Workshop mod downloads.
|
||||
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
|
||||
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
|
||||
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD
|
||||
GAME_ID=221100 # SteamCMD ID for the DayZ GAME (not server). Only used for Workshop mod downloads.
|
||||
|
||||
# Color Codes
|
||||
CYAN='\033[0;36m'
|
||||
@@ -33,24 +33,24 @@ function RunSteamCMD { #[Input: int server=0 mod=1; 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
|
||||
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
|
||||
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\|thread") ]]; then # Catch errors (ignore setlocale, SDL, and thread priority warnings)
|
||||
@@ -98,7 +98,7 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
|
||||
echo -e "\t${YELLOW}(Please contact your administrator/host for support)${NC}\n"
|
||||
cp -r /tmp/dumps /home/container/dumps
|
||||
exit $steamcmdExitCode
|
||||
else # Success!
|
||||
else # Success!
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}"
|
||||
else # Mod
|
||||
@@ -116,8 +116,8 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if (( $updateAttempt == $STEAMCMD_ATTEMPTS )); then # Notify if failed last attempt
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
if (($updateAttempt == $STEAMCMD_ATTEMPTS)); then # Notify if failed last attempt
|
||||
if [[ $1 == 0 ]]; then # Server
|
||||
echo -e "\t${RED}Final attempt made! ${YELLOW}Unable to complete game server update. ${CYAN}Skipping...${NC}"
|
||||
echo -e "\t(Please try again at a later time)"
|
||||
sleep 3
|
||||
@@ -133,11 +133,9 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
|
||||
# Takes a directory (string) as input, and recursively makes all files & folders lowercase.
|
||||
function ModsLowercase {
|
||||
echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..."
|
||||
for SRC in `find ./$1 -depth`
|
||||
do
|
||||
DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
|
||||
if [ "${SRC}" != "${DST}" ]
|
||||
then
|
||||
for SRC in $(find ./$1 -depth); do
|
||||
DST=$(dirname "${SRC}")/$(basename "${SRC}" | tr '[A-Z]' '[a-z]')
|
||||
if [ "${SRC}" != "${DST}" ]; then
|
||||
[ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}"
|
||||
fi
|
||||
done
|
||||
@@ -145,7 +143,7 @@ function ModsLowercase {
|
||||
|
||||
# Removes duplicate items from a semicolon delimited string
|
||||
function RemoveDuplicates { #[Input: str - Output: printf of new str]
|
||||
if [[ -n $1 ]]; then # If nothing to compare, skip to prevent extra semicolon being returned
|
||||
if [[ -n $1 ]]; then # If nothing to compare, skip to prevent extra semicolon being returned
|
||||
echo $1 | sed -e 's/;/\n/g' | sort -u | xargs printf '%s;'
|
||||
fi
|
||||
}
|
||||
@@ -185,26 +183,26 @@ if [[ -n ${SERVERMODS} ]] && [[ ${SERVERMODS} != *\; ]]; then
|
||||
else
|
||||
allMods=${SERVERMODS}
|
||||
fi
|
||||
allMods+=$CLIENT_MODS # Add all client-side mods to the master mod list
|
||||
allMods+=$CLIENT_MODS # Add all client-side mods to the master mod list
|
||||
CLIENT_MODS=$(RemoveDuplicates ${CLIENT_MODS}) # Remove duplicate mods from CLIENT_MODS, if present
|
||||
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, if present
|
||||
allMods=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
|
||||
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, if present
|
||||
allMods=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
|
||||
|
||||
# Update everything (server and mods), if specified
|
||||
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\" and \"thread priority\" 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"
|
||||
@@ -213,19 +211,18 @@ 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..."
|
||||
for modID in $(echo $allMods | sed -e 's/@//g')
|
||||
do
|
||||
for modID in $(echo $allMods | sed -e 's/@//g'); do
|
||||
if [[ $modID =~ ^[0-9]+$ ]]; then # Only check mods that are in ID-form
|
||||
# Get mod's latest update in epoch time from its Steam Workshop changelog page
|
||||
latestUpdate=$(curl -sL https://steamcommunity.com/sharedfiles/filedetails/changelog/$modID | grep '<p id=' | head -1 | cut -d'"' -f2)
|
||||
# If the update time is valid and newer than the local directory's creation date, or the mod hasn't been downloaded yet, download the mod
|
||||
if [[ ! -d @$modID ]] || [[ ( -n $latestUpdate ) && ( $latestUpdate =~ ^[0-9]+$ ) && ( $latestUpdate > $(find @$modID | head -1 | xargs stat -c%Y) ) ]]; then
|
||||
if [[ ! -d @$modID ]] || [[ (-n $latestUpdate) && ($latestUpdate =~ ^[0-9]+$) && ($latestUpdate > $(find @$modID | head -1 | xargs stat -c%Y)) ]]; then
|
||||
# Get the mod's name from the Workshop page as well
|
||||
modName=$(curl -sL https://steamcommunity.com/sharedfiles/filedetails/changelog/$modID | grep 'workshopItemTitle' | cut -d'>' -f2 | cut -d'<' -f1)
|
||||
if [[ -z $modName ]]; then # Set default name if unavailable
|
||||
@@ -239,7 +236,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
|
||||
if [[ -n $latestUpdate ]] && [[ $latestUpdate =~ ^[0-9]+$ ]]; then # Notify last update date, if valid
|
||||
echo -e "\tMod was last updated: ${CYAN}$(date -d @${latestUpdate})${NC}"
|
||||
fi
|
||||
|
||||
|
||||
# Delete SteamCMD appworkshop cache before running to avoid mod download failures
|
||||
echo -e "\tClearing SteamCMD appworkshop cache..."
|
||||
rm -f ${WORKSHOP_DIR}/appworkshop_$GAME_ID.acf
|
||||
@@ -265,8 +262,7 @@ fi
|
||||
|
||||
# Make mods lowercase, if specified
|
||||
if [[ ${MODS_LOWERCASE} == "1" ]]; then
|
||||
for modDir in $allMods
|
||||
do
|
||||
for modDir in $allMods; do
|
||||
ModsLowercase $modDir
|
||||
done
|
||||
fi
|
||||
@@ -274,11 +270,11 @@ fi
|
||||
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
|
||||
export USER_ID=$(id -u)
|
||||
export GROUP_ID=$(id -g)
|
||||
envsubst < /passwd.template > ${NSS_WRAPPER_PASSWD}
|
||||
envsubst </passwd.template >${NSS_WRAPPER_PASSWD}
|
||||
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
|
||||
|
||||
# Replace Startup Variables
|
||||
modifiedStartup=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
||||
modifiedStartup=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
|
||||
# Start the Server
|
||||
echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:"
|
||||
|
||||
+14
-14
@@ -15,34 +15,34 @@ ENV USER=container HOME=/home/container
|
||||
|
||||
## Update base packages
|
||||
RUN apt update \
|
||||
&& apt upgrade -y
|
||||
&& apt upgrade -y
|
||||
|
||||
## Install dependencies
|
||||
RUN apt install -y gcc g++ libgcc-12-dev libc++-dev gdb libc6 git git-lfs wget curl tar zip unzip binutils xz-utils liblzo2-2 cabextract iproute2 net-tools netcat-traditional telnet libatomic1 libsdl1.2debian libsdl2-2.0-0 \
|
||||
libfontconfig1 icu-devtools libunwind8 libssl-dev sqlite3 libsqlite3-dev libmariadb-dev-compat libduktape207 locales ffmpeg gnupg2 apt-transport-https software-properties-common ca-certificates \
|
||||
liblua5.3-0 libz3-dev libzadc4 rapidjson-dev tzdata libevent-dev libzip4 libprotobuf32 libfluidsynth3 procps libstdc++6 tini jq file
|
||||
libfontconfig1 icu-devtools libunwind8 libssl-dev sqlite3 libsqlite3-dev libmariadb-dev-compat libduktape207 locales ffmpeg gnupg2 apt-transport-https software-properties-common ca-certificates \
|
||||
liblua5.3-0 libz3-dev libzadc4 rapidjson-dev tzdata libevent-dev libzip4 libprotobuf32 libfluidsynth3 procps libstdc++6 tini jq file
|
||||
|
||||
# Temp fix for libicu66.1 for RAGE-MP and libssl1.1 for fivem and many more
|
||||
RUN if [ "$(uname -m)" = "x86_64" ]; then \
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2.1_amd64.deb && \
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
|
||||
dpkg -i libicu66_66.1-2ubuntu2.1_amd64.deb && \
|
||||
dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
|
||||
rm libicu66_66.1-2ubuntu2.1_amd64.deb libssl1.1_1.1.0g-2ubuntu4_amd64.deb; \
|
||||
fi
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2.1_amd64.deb && \
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
|
||||
dpkg -i libicu66_66.1-2ubuntu2.1_amd64.deb && \
|
||||
dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
|
||||
rm libicu66_66.1-2ubuntu2.1_amd64.deb libssl1.1_1.1.0g-2ubuntu4_amd64.deb; \
|
||||
fi
|
||||
# ARM64
|
||||
RUN if [ ! "$(uname -m)" = "x86_64" ]; then \
|
||||
wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \
|
||||
dpkg -i libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \
|
||||
rm libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \
|
||||
fi
|
||||
wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \
|
||||
dpkg -i libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \
|
||||
rm libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \
|
||||
fi
|
||||
|
||||
## Configure Git Lfs
|
||||
RUN git lfs install
|
||||
|
||||
## Configure locale
|
||||
RUN update-locale lang=en_US.UTF-8 \
|
||||
&& dpkg-reconfigure --frontend noninteractive locales
|
||||
&& dpkg-reconfigure --frontend noninteractive locales
|
||||
|
||||
|
||||
WORKDIR /home/container
|
||||
|
||||
+39
-39
@@ -4,52 +4,52 @@ cd /home/container
|
||||
# Auto update resources from git.
|
||||
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
|
||||
|
||||
# Pre git stuff
|
||||
echo "Wait, preparing to pull or clone from git.";
|
||||
# Pre git stuff
|
||||
echo "Wait, preparing to pull or clone from git."
|
||||
|
||||
mkdir -p /home/container/resources
|
||||
cd /home/container/resources
|
||||
mkdir -p /home/container/resources
|
||||
cd /home/container/resources
|
||||
|
||||
# Git stuff
|
||||
if [[ ${GIT_REPOURL} != *.git ]]; then # Add .git at end of URL
|
||||
GIT_REPOURL=${GIT_REPOURL}.git
|
||||
fi
|
||||
|
||||
if [ -z "${GIT_USERNAME}" ] && [ -z "${GIT_TOKEN}" ]; then # Check for git username & token
|
||||
echo -e "git Username or git Token was not specified."
|
||||
else
|
||||
GIT_REPOURL="https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo -e ${GIT_REPOURL} | cut -d/ -f3-)"
|
||||
fi
|
||||
|
||||
if [ "$(ls -A /home/container/resources)" ]; then # Files exist in resources folder, pull
|
||||
echo "Files exist in /home/container/resources/. Attempting to pull from git repository."
|
||||
|
||||
# Get git origin from /home/container/resources/.git/config
|
||||
if [ -d .git ]; then
|
||||
if [ -f .git/config ]; then
|
||||
GIT_ORIGIN=$(git config --get remote.origin.url)
|
||||
fi
|
||||
# Git stuff
|
||||
if [[ ${GIT_REPOURL} != *.git ]]; then # Add .git at end of URL
|
||||
GIT_REPOURL=${GIT_REPOURL}.git
|
||||
fi
|
||||
|
||||
# If git origin matches the repo specified by user then pull
|
||||
if [ "${GIT_ORIGIN}" == "${GIT_REPOURL}" ]; then #
|
||||
git pull && echo "Finished pulling /home/container/resources/ from git." || echo "Failed pulling /home/container/resources/ from git."
|
||||
else
|
||||
echo -e "git repository in /home/container/resources/ does not match user provided configuration. Failed pulling /home/container/resources/ from git."
|
||||
fi
|
||||
else # No files exist in resources folder, clone
|
||||
echo -e "Resources directory is empty. Attempting to clone git repository."
|
||||
if [ -z ${GIT_BRANCH} ]; then
|
||||
echo -e "Cloning default branch into /home/container/resources/."
|
||||
git clone ${GIT_REPOURL} .
|
||||
if [ -z "${GIT_USERNAME}" ] && [ -z "${GIT_TOKEN}" ]; then # Check for git username & token
|
||||
echo -e "git Username or git Token was not specified."
|
||||
else
|
||||
echo -e "Cloning ${GIT_BRANCH} branch into /home/container/resources/."
|
||||
git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOURL} . && echo "Finished cloning into /home/container/resources/ from git." || echo "Failed cloning into /home/container/resources/ from git."
|
||||
GIT_REPOURL="https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo -e ${GIT_REPOURL} | cut -d/ -f3-)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Post git stuff
|
||||
cd /home/container
|
||||
if [ "$(ls -A /home/container/resources)" ]; then # Files exist in resources folder, pull
|
||||
echo "Files exist in /home/container/resources/. Attempting to pull from git repository."
|
||||
|
||||
# Get git origin from /home/container/resources/.git/config
|
||||
if [ -d .git ]; then
|
||||
if [ -f .git/config ]; then
|
||||
GIT_ORIGIN=$(git config --get remote.origin.url)
|
||||
fi
|
||||
fi
|
||||
|
||||
# If git origin matches the repo specified by user then pull
|
||||
if [ "${GIT_ORIGIN}" == "${GIT_REPOURL}" ]; then #
|
||||
git pull && echo "Finished pulling /home/container/resources/ from git." || echo "Failed pulling /home/container/resources/ from git."
|
||||
else
|
||||
echo -e "git repository in /home/container/resources/ does not match user provided configuration. Failed pulling /home/container/resources/ from git."
|
||||
fi
|
||||
else # No files exist in resources folder, clone
|
||||
echo -e "Resources directory is empty. Attempting to clone git repository."
|
||||
if [ -z ${GIT_BRANCH} ]; then
|
||||
echo -e "Cloning default branch into /home/container/resources/."
|
||||
git clone ${GIT_REPOURL} .
|
||||
else
|
||||
echo -e "Cloning ${GIT_BRANCH} branch into /home/container/resources/."
|
||||
git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOURL} . && echo "Finished cloning into /home/container/resources/ from git." || echo "Failed cloning into /home/container/resources/ from git."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Post git stuff
|
||||
cd /home/container
|
||||
fi
|
||||
|
||||
# Make internal Docker IP address available to processes.
|
||||
|
||||
@@ -20,4 +20,4 @@ MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
|
||||
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
eval ${MODIFIED_STARTUP}
|
||||
eval ${MODIFIED_STARTUP}
|
||||
@@ -10,4 +10,4 @@ MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/
|
||||
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
eval ${MODIFIED_STARTUP}
|
||||
eval ${MODIFIED_STARTUP}
|
||||
@@ -2,18 +2,18 @@
|
||||
cd /home/container
|
||||
|
||||
# Make internal Docker IP address available to processes.
|
||||
export INTERNAL_IP=`ip route get 1 | awk '{print $(NF-2);exit}'`
|
||||
export INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||
|
||||
## if auto_update is not set or to 1 update
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Allow for the staging branch to also update itself
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login anonymous +app_update 258550 $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) +quit
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login anonymous +app_update 258550 $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") +quit
|
||||
else
|
||||
echo -e "Not updating game server as auto update was set to 0. Starting Server"
|
||||
fi
|
||||
|
||||
# Replace Startup Variables
|
||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
||||
MODIFIED_STARTUP=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
if [[ "${FRAMEWORK}" == "carbon" ]]; then
|
||||
@@ -34,7 +34,7 @@ elif [[ "${FRAMEWORK}" == "oxide-staging" ]]; then
|
||||
elif [[ "$OXIDE" == "1" ]] || [[ "${FRAMEWORK}" == "oxide" ]]; then
|
||||
# Oxide: https://github.com/OxideMod/Oxide.Rust
|
||||
echo "Updating uMod..."
|
||||
curl -sSL "https://github.com/OxideMod/Oxide.Rust/releases/latest/download/Oxide.Rust-linux.zip" > umod.zip
|
||||
curl -sSL "https://github.com/OxideMod/Oxide.Rust/releases/latest/download/Oxide.Rust-linux.zip" >umod.zip
|
||||
unzip -o -q umod.zip
|
||||
rm umod.zip
|
||||
echo "Done updating uMod!"
|
||||
@@ -45,4 +45,4 @@ fi
|
||||
export LD_LIBRARY_PATH=$(pwd)/RustDedicated_Data/Plugins/x86_64:$(pwd)
|
||||
|
||||
# Run the Server
|
||||
/wrapper/wrapper.js "${MODIFIED_STARTUP}"
|
||||
/wrapper/wrapper.js "${MODIFIED_STARTUP}"
|
||||
@@ -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-2);exit}'`
|
||||
export INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||
|
||||
# Replace Startup Variables
|
||||
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
|
||||
|
||||
@@ -36,7 +36,6 @@ export INTERNAL_IP
|
||||
# Switch to the container's working directory
|
||||
cd /home/container || exit 1
|
||||
|
||||
|
||||
## just in case someone removed the defaults.
|
||||
if [ "${STEAM_USER}" == "" ]; then
|
||||
echo -e "steam user is not set.\n"
|
||||
@@ -49,14 +48,14 @@ else
|
||||
fi
|
||||
|
||||
## if auto_update is not set or to 1 update
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Update Source Server
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
fi
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
fi
|
||||
else
|
||||
echo -e "No appid set. Starting Server"
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,6 @@ cd /home/container
|
||||
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
|
||||
echo -e "steam user is not set.\n"
|
||||
@@ -21,7 +20,7 @@ fi
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Update Source Server
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
else
|
||||
echo -e "No appid set. Starting Server"
|
||||
fi
|
||||
@@ -30,11 +29,10 @@ else
|
||||
echo -e "Not updating game server as auto update was set to 0. Starting Server"
|
||||
fi
|
||||
|
||||
|
||||
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
|
||||
export USER_ID=$(id -u)
|
||||
export GROUP_ID=$(id -g)
|
||||
envsubst < /passwd.template > ${NSS_WRAPPER_PASSWD}
|
||||
envsubst </passwd.template >${NSS_WRAPPER_PASSWD}
|
||||
|
||||
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
|
||||
|
||||
|
||||
+162
-162
@@ -38,237 +38,237 @@ DEFAULT_BRANCH="main"
|
||||
|
||||
# Normalize repository URL
|
||||
normalize_repo_url() {
|
||||
local url="$1"
|
||||
local url="$1"
|
||||
|
||||
# Remove any existing credentials (user:token@)
|
||||
url=$(echo "$url" | sed 's|https://[^@]*@|https://|')
|
||||
# Remove any existing credentials (user:token@)
|
||||
url=$(echo "$url" | sed 's|https://[^@]*@|https://|')
|
||||
|
||||
# Add .git suffix if not present
|
||||
if [[ "$url" != *.git ]]; then
|
||||
url="${url}.git"
|
||||
fi
|
||||
# Add .git suffix if not present
|
||||
if [[ "$url" != *.git ]]; then
|
||||
url="${url}.git"
|
||||
fi
|
||||
|
||||
echo "$url"
|
||||
echo "$url"
|
||||
}
|
||||
|
||||
# Construct authenticated URL
|
||||
construct_auth_url() {
|
||||
local repo_url="$1"
|
||||
local username="$2"
|
||||
local token="$3"
|
||||
local repo_url="$1"
|
||||
local username="$2"
|
||||
local token="$3"
|
||||
|
||||
# Remove https:// prefix
|
||||
repo_url="${repo_url#https://}"
|
||||
# Remove https:// prefix
|
||||
repo_url="${repo_url#https://}"
|
||||
|
||||
# Construct authenticated URL
|
||||
echo "https://${username}:${token}@${repo_url}"
|
||||
# Construct authenticated URL
|
||||
echo "https://${username}:${token}@${repo_url}"
|
||||
}
|
||||
|
||||
# Extract repository info for logging
|
||||
get_repo_info() {
|
||||
local url="$1"
|
||||
local normalized_url=$(normalize_repo_url "$url")
|
||||
local url="$1"
|
||||
local normalized_url=$(normalize_repo_url "$url")
|
||||
|
||||
# Extract owner/repo from URL
|
||||
local repo_path=$(echo "$normalized_url" | sed 's|https://github.com/||' | sed 's|\.git$||')
|
||||
echo "$repo_path"
|
||||
# Extract owner/repo from URL
|
||||
local repo_path=$(echo "$normalized_url" | sed 's|https://github.com/||' | sed 's|\.git$||')
|
||||
echo "$repo_path"
|
||||
}
|
||||
|
||||
# Check if current directory is a git repository
|
||||
is_git_repo() {
|
||||
[ -d ".git" ] && [ -f ".git/config" ]
|
||||
[ -d ".git" ] && [ -f ".git/config" ]
|
||||
}
|
||||
|
||||
# Check if repository URLs match (ignores credentials)
|
||||
urls_match() {
|
||||
local url1="$1"
|
||||
local url2="$2"
|
||||
local url1="$1"
|
||||
local url2="$2"
|
||||
|
||||
local normalized1=$(normalize_repo_url "$url1")
|
||||
local normalized2=$(normalize_repo_url "$url2")
|
||||
local normalized1=$(normalize_repo_url "$url1")
|
||||
local normalized2=$(normalize_repo_url "$url2")
|
||||
|
||||
[ "$normalized1" = "$normalized2" ]
|
||||
[ "$normalized1" = "$normalized2" ]
|
||||
}
|
||||
|
||||
# update git remote URL with new credentials (needed for when a user switches PAT's)
|
||||
update_remote_url() {
|
||||
local new_url="$1"
|
||||
echo "Updating remote URL with new credentials..."
|
||||
git remote set-url origin "$new_url"
|
||||
echo "Remote URL updated successfully"
|
||||
local new_url="$1"
|
||||
echo "Updating remote URL with new credentials..."
|
||||
git remote set-url origin "$new_url"
|
||||
echo "Remote URL updated successfully"
|
||||
}
|
||||
|
||||
# Apply updates for custom repo
|
||||
perform_git_update() {
|
||||
local branch="$1"
|
||||
local repo_info="$2"
|
||||
local branch="$1"
|
||||
local repo_info="$2"
|
||||
|
||||
echo ""
|
||||
echo "Fetching latest changes from remote..."
|
||||
echo ""
|
||||
echo "Fetching latest changes from remote..."
|
||||
|
||||
# Check if we have a shallow clone
|
||||
local is_shallow=$(git rev-parse --is-shallow-repository 2>/dev/null || echo "false")
|
||||
# Check if we have a shallow clone
|
||||
local is_shallow=$(git rev-parse --is-shallow-repository 2>/dev/null || echo "false")
|
||||
|
||||
# Switch branches if necessary
|
||||
local current_branch=$(git branch --show-current 2>/dev/null || echo "")
|
||||
# Switch branches if necessary
|
||||
local current_branch=$(git branch --show-current 2>/dev/null || echo "")
|
||||
|
||||
# Check if we need to switch branches
|
||||
if [ "$current_branch" != "$branch" ]; then
|
||||
echo "Adding remote branch reference for '$branch'..."
|
||||
git remote set-branches --add origin "$branch"
|
||||
fi
|
||||
# Check if we need to switch branches
|
||||
if [ "$current_branch" != "$branch" ]; then
|
||||
echo "Adding remote branch reference for '$branch'..."
|
||||
git remote set-branches --add origin "$branch"
|
||||
fi
|
||||
|
||||
# Fetch based on whether it's shallow or not
|
||||
if [ "$is_shallow" = "true" ]; then
|
||||
echo "Detected shallow repository, fetching with depth 1..."
|
||||
git fetch --depth 1 origin "$branch"
|
||||
else
|
||||
echo "Fetching full history..."
|
||||
git fetch origin "$branch"
|
||||
fi
|
||||
# Fetch based on whether it's shallow or not
|
||||
if [ "$is_shallow" = "true" ]; then
|
||||
echo "Detected shallow repository, fetching with depth 1..."
|
||||
git fetch --depth 1 origin "$branch"
|
||||
else
|
||||
echo "Fetching full history..."
|
||||
git fetch origin "$branch"
|
||||
fi
|
||||
|
||||
echo "Updating local files to match remote branch..."
|
||||
echo "Updating local files to match remote branch..."
|
||||
|
||||
if [ "$current_branch" != "$branch" ]; then
|
||||
echo "Switching from branch '$current_branch' to '$branch'..."
|
||||
if [ "$current_branch" != "$branch" ]; then
|
||||
echo "Switching from branch '$current_branch' to '$branch'..."
|
||||
|
||||
# Check if local branch exists
|
||||
if git show-ref --verify --quiet "refs/heads/$branch"; then
|
||||
echo "Local branch '$branch' exists, checking out..."
|
||||
git checkout "$branch"
|
||||
else
|
||||
echo "Creating and checking out new local branch '$branch'..."
|
||||
git checkout -b "$branch" "origin/$branch"
|
||||
fi
|
||||
fi
|
||||
# Check if local branch exists
|
||||
if git show-ref --verify --quiet "refs/heads/$branch"; then
|
||||
echo "Local branch '$branch' exists, checking out..."
|
||||
git checkout "$branch"
|
||||
else
|
||||
echo "Creating and checking out new local branch '$branch'..."
|
||||
git checkout -b "$branch" "origin/$branch"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Deploy changes
|
||||
echo "Updating local files to match remote branch..."
|
||||
git reset --hard "origin/$branch"
|
||||
# Deploy changes
|
||||
echo "Updating local files to match remote branch..."
|
||||
git reset --hard "origin/$branch"
|
||||
|
||||
# Get latest commit info for logging
|
||||
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
|
||||
# Get latest commit info for logging
|
||||
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
|
||||
|
||||
echo ""
|
||||
echo "✅ Successfully updated repository!"
|
||||
echo "Repository: $repo_info"
|
||||
echo "Branch: $branch"
|
||||
echo "Latest commit: $latest_commit"
|
||||
echo ""
|
||||
echo "✅ Successfully updated repository!"
|
||||
echo "Repository: $repo_info"
|
||||
echo "Branch: $branch"
|
||||
echo "Latest commit: $latest_commit"
|
||||
}
|
||||
|
||||
# Clone custom repo
|
||||
perform_git_clone() {
|
||||
local repo_url="$1"
|
||||
local branch="$2"
|
||||
local repo_info="$3"
|
||||
local repo_url="$1"
|
||||
local branch="$2"
|
||||
local repo_info="$3"
|
||||
|
||||
echo ""
|
||||
echo "Cloning repository into container directory..."
|
||||
echo ""
|
||||
echo "Cloning repository into container directory..."
|
||||
|
||||
if [ -z "$branch" ]; then
|
||||
echo "Cloning default branch..."
|
||||
git clone --single-branch --depth 1 "$repo_url" .
|
||||
else
|
||||
echo "Cloning branch: $branch"
|
||||
git clone --single-branch --branch "$branch" --depth 1 "$repo_url" .
|
||||
fi
|
||||
if [ -z "$branch" ]; then
|
||||
echo "Cloning default branch..."
|
||||
git clone --single-branch --depth 1 "$repo_url" .
|
||||
else
|
||||
echo "Cloning branch: $branch"
|
||||
git clone --single-branch --branch "$branch" --depth 1 "$repo_url" .
|
||||
fi
|
||||
|
||||
# Get current branch and latest commit for logging
|
||||
local current_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
||||
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
|
||||
# Get current branch and latest commit for logging
|
||||
local current_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
||||
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
|
||||
|
||||
echo ""
|
||||
echo "✅ Successfully cloned repository!"
|
||||
echo "Repository: $repo_info"
|
||||
echo "Branch: $current_branch"
|
||||
echo "Latest commit: $latest_commit"
|
||||
echo ""
|
||||
echo "✅ Successfully cloned repository!"
|
||||
echo "Repository: $repo_info"
|
||||
echo "Branch: $current_branch"
|
||||
echo "Latest commit: $latest_commit"
|
||||
}
|
||||
|
||||
# Auto update server from git.
|
||||
perform_git_logic() {
|
||||
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
|
||||
echo "Git auto-update is enabled"
|
||||
echo ""
|
||||
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
|
||||
echo "Git auto-update is enabled"
|
||||
echo ""
|
||||
|
||||
# Validate variables
|
||||
if [ -z "${GIT_REPOURL}" ]; then
|
||||
echo "❌ Error: GIT_REPOURL is not specified"
|
||||
exit 1
|
||||
fi
|
||||
# Validate variables
|
||||
if [ -z "${GIT_REPOURL}" ]; then
|
||||
echo "❌ Error: GIT_REPOURL is not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then
|
||||
echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified"
|
||||
echo " Both are required for private repository access"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then
|
||||
echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified"
|
||||
echo " Both are required for private repository access"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local normalized_repo_url=$(normalize_repo_url "$GIT_REPOURL")
|
||||
local auth_repo_url=$(construct_auth_url "$normalized_repo_url" "$GIT_USERNAME" "$GIT_TOKEN")
|
||||
local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}"
|
||||
local repo_info=$(get_repo_info "$GIT_REPOURL")
|
||||
local normalized_repo_url=$(normalize_repo_url "$GIT_REPOURL")
|
||||
local auth_repo_url=$(construct_auth_url "$normalized_repo_url" "$GIT_USERNAME" "$GIT_TOKEN")
|
||||
local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}"
|
||||
local repo_info=$(get_repo_info "$GIT_REPOURL")
|
||||
|
||||
echo "Git Configuration:"
|
||||
echo " Repository: $repo_info"
|
||||
echo " Branch: $branch"
|
||||
echo " Target directory: $CONTAINER_DIR"
|
||||
echo "Git Configuration:"
|
||||
echo " Repository: $repo_info"
|
||||
echo " Branch: $branch"
|
||||
echo " Target directory: $CONTAINER_DIR"
|
||||
|
||||
# Check if directory has content
|
||||
if [ "$(ls -A .)" ]; then
|
||||
echo ""
|
||||
echo "Container directory is not empty, checking for existing repository..."
|
||||
# Check if directory has content
|
||||
if [ "$(ls -A .)" ]; then
|
||||
echo ""
|
||||
echo "Container directory is not empty, checking for existing repository..."
|
||||
|
||||
if is_git_repo; then
|
||||
echo "Found existing git repository"
|
||||
if is_git_repo; then
|
||||
echo "Found existing git repository"
|
||||
|
||||
# Get current remote URL
|
||||
local current_remote=$(git config --get remote.origin.url 2>/dev/null || echo "")
|
||||
# Get current remote URL
|
||||
local current_remote=$(git config --get remote.origin.url 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$current_remote" ]; then
|
||||
echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')"
|
||||
if [ -n "$current_remote" ]; then
|
||||
echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')"
|
||||
|
||||
# Check if URLs match (ignoring credentials)
|
||||
if urls_match "$current_remote" "$normalized_repo_url"; then
|
||||
echo "Repository URLs match"
|
||||
# Check if URLs match (ignoring credentials)
|
||||
if urls_match "$current_remote" "$normalized_repo_url"; then
|
||||
echo "Repository URLs match"
|
||||
|
||||
# Update remote URL with new credentials (handles PAT changes)
|
||||
update_remote_url "$auth_repo_url"
|
||||
# Update remote URL with new credentials (handles PAT changes)
|
||||
update_remote_url "$auth_repo_url"
|
||||
|
||||
# Perform update
|
||||
perform_git_update "$branch" "$repo_info"
|
||||
else
|
||||
echo "❌ Repository mismatch!"
|
||||
echo " Expected: $repo_info"
|
||||
echo " Found: $(get_repo_info "$current_remote")"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Could not determine current remote URL"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Directory contains files but is not a git repository"
|
||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Container directory is empty, performing initial clone..."
|
||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||
fi
|
||||
# Perform update
|
||||
perform_git_update "$branch" "$repo_info"
|
||||
else
|
||||
echo "❌ Repository mismatch!"
|
||||
echo " Expected: $repo_info"
|
||||
echo " Found: $(get_repo_info "$current_remote")"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Could not determine current remote URL"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Directory contains files but is not a git repository"
|
||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Container directory is empty, performing initial clone..."
|
||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✅ Git auto-update completed successfully!"
|
||||
echo "Working directory: $(pwd)"
|
||||
echo ""
|
||||
echo "✅ Git auto-update completed successfully!"
|
||||
echo "Working directory: $(pwd)"
|
||||
|
||||
# Final verification
|
||||
if is_git_repo; then
|
||||
local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
||||
echo "Current branch: $final_branch"
|
||||
fi
|
||||
# Final verification
|
||||
if is_git_repo; then
|
||||
local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
||||
echo "Current branch: $final_branch"
|
||||
fi
|
||||
|
||||
# Post git stuff
|
||||
cd /home/container
|
||||
fi
|
||||
# Post git stuff
|
||||
cd /home/container
|
||||
fi
|
||||
}
|
||||
|
||||
perform_git_logic
|
||||
|
||||
+3
-4
@@ -26,13 +26,13 @@ if [ ! -z "${SRCDS_APPID}" ]; then
|
||||
fi
|
||||
|
||||
## if auto_update is not set or to 1 update
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Update Source Server
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
fi
|
||||
else
|
||||
echo -e "No appid set. Starting Server"
|
||||
@@ -43,7 +43,6 @@ if [ ! -z "${SRCDS_APPID}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Replace Startup Variables
|
||||
MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
|
||||
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
@@ -9,7 +9,7 @@ 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')`
|
||||
MODIFIED_STARTUP=$(eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
|
||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
|
||||
@@ -36,7 +36,7 @@ export INTERNAL_IP
|
||||
# Set environment for Steam Proton
|
||||
if [ -f "/usr/local/bin/proton" ]; then
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
mkdir -p /home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}
|
||||
mkdir -p /home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}
|
||||
export STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/container/.steam/steam"
|
||||
export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
|
||||
# Fix for pipx with protontricks
|
||||
@@ -47,7 +47,7 @@ if [ -f "/usr/local/bin/proton" ]; then
|
||||
echo -e "Server stops now"
|
||||
echo -e "----------------------------------------------------------------------------------"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Switch to the container's working directory
|
||||
@@ -65,14 +65,14 @@ else
|
||||
fi
|
||||
|
||||
## if auto_update is not set or to 1 update
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Update Source Server
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
|
||||
fi
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") ${INSTALL_FLAGS} $([[ "${VALIDATE}" == "1" ]] && printf %s 'validate') +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") ${INSTALL_FLAGS} $([[ "${VALIDATE}" == "1" ]] && printf %s 'validate') +quit
|
||||
fi
|
||||
else
|
||||
echo -e "No appid set. Starting Server"
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,7 @@ log() {
|
||||
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOGFILE
|
||||
}
|
||||
|
||||
install_dep(){
|
||||
install_dep() {
|
||||
log "Installing dependencies..."
|
||||
apt update && apt -y install \
|
||||
build-essential \
|
||||
@@ -58,22 +58,22 @@ install_amd64_multilib() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Multilib AMD64 installed successfully"
|
||||
log "Multilib AMD64 installed successfully"
|
||||
}
|
||||
|
||||
# Function to install multilib support on arm64
|
||||
install_arm64_multilib() {
|
||||
apt -y install g++-multilib-x86-64-linux-gnu g++-aarch64-linux-gnu libc6-dev-armhf-cross
|
||||
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log "Failed to install amd multilib dependency"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Multilib ARM64 installed successfully"
|
||||
log "Multilib ARM64 installed successfully"
|
||||
}
|
||||
|
||||
clone_mumble(){
|
||||
clone_mumble() {
|
||||
log "Cloning the Mumble repository..."
|
||||
|
||||
# Create the necessary directories
|
||||
@@ -105,7 +105,7 @@ clone_mumble(){
|
||||
# Create and navigate to the build directory
|
||||
mkdir -p build && cd build
|
||||
|
||||
echo "$LATEST_TAG" > latest_tag.txt
|
||||
echo "$LATEST_TAG" >latest_tag.txt
|
||||
|
||||
# Run cmake with the specified options
|
||||
cmake -Dbundled-opus=OFF -Dclient=OFF -Dstatic=ON -DCMAKE_BUILD_TYPE=Release ..
|
||||
@@ -117,7 +117,7 @@ clone_mumble(){
|
||||
log "Repository cloned and configured successfully"
|
||||
}
|
||||
|
||||
build_mumble(){
|
||||
build_mumble() {
|
||||
log "Building Mumble server..."
|
||||
|
||||
cd /usr/src/mumble/git/build
|
||||
|
||||
@@ -14,4 +14,4 @@ MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/
|
||||
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
|
||||
|
||||
# Run the Server
|
||||
eval ${MODIFIED_STARTUP}
|
||||
eval ${MODIFIED_STARTUP}
|
||||
+25
-25
@@ -22,14 +22,14 @@ else
|
||||
fi
|
||||
|
||||
## if auto_update is not set or to 1 update
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
|
||||
# Update Source Server
|
||||
if [ ! -z ${SRCDS_APPID} ]; then
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update 1007 +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) $( [[ -z ${VALIDATE} ]] || printf %s "validate" ) +quit
|
||||
fi
|
||||
if [ "${STEAM_USER}" == "anonymous" ]; then
|
||||
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
else
|
||||
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $([[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows') +app_update 1007 +app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") $([[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") $([[ -z ${VALIDATE} ]] || printf %s "validate") +quit
|
||||
fi
|
||||
else
|
||||
echo -e "No appid set. Starting Server"
|
||||
fi
|
||||
@@ -39,7 +39,7 @@ else
|
||||
fi
|
||||
|
||||
if [[ $XVFB == 1 ]]; then
|
||||
Xvfb :0 -screen 0 ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}x${DISPLAY_DEPTH} &
|
||||
Xvfb :0 -screen 0 ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}x${DISPLAY_DEPTH} &
|
||||
fi
|
||||
|
||||
# Install necessary to run packages
|
||||
@@ -49,37 +49,37 @@ mkdir -p $WINEPREFIX
|
||||
|
||||
# Check if wine-gecko required and install it if so
|
||||
if [[ $WINETRICKS_RUN =~ gecko ]]; then
|
||||
echo "Installing Gecko"
|
||||
WINETRICKS_RUN=${WINETRICKS_RUN/gecko}
|
||||
echo "Installing Gecko"
|
||||
WINETRICKS_RUN=${WINETRICKS_RUN/gecko/}
|
||||
|
||||
if [ ! -f "$WINEPREFIX/gecko_x86.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/gecko_x86.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86.msi
|
||||
fi
|
||||
if [ ! -f "$WINEPREFIX/gecko_x86.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/gecko_x86.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86.msi
|
||||
fi
|
||||
|
||||
if [ ! -f "$WINEPREFIX/gecko_x86_64.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/gecko_x86_64.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86_64.msi
|
||||
fi
|
||||
if [ ! -f "$WINEPREFIX/gecko_x86_64.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/gecko_x86_64.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86_64.msi
|
||||
fi
|
||||
|
||||
wine msiexec /i $WINEPREFIX/gecko_x86.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_install.log
|
||||
wine msiexec /i $WINEPREFIX/gecko_x86_64.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_64_install.log
|
||||
wine msiexec /i $WINEPREFIX/gecko_x86.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_install.log
|
||||
wine msiexec /i $WINEPREFIX/gecko_x86_64.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_64_install.log
|
||||
fi
|
||||
|
||||
# Check if wine-mono required and install it if so
|
||||
if [[ $WINETRICKS_RUN =~ mono ]]; then
|
||||
echo "Installing mono"
|
||||
WINETRICKS_RUN=${WINETRICKS_RUN/mono}
|
||||
echo "Installing mono"
|
||||
WINETRICKS_RUN=${WINETRICKS_RUN/mono/}
|
||||
|
||||
if [ ! -f "$WINEPREFIX/mono.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/mono.msi https://dl.winehq.org/wine/wine-mono/9.1.0/wine-mono-9.1.0-x86.msi
|
||||
fi
|
||||
if [ ! -f "$WINEPREFIX/mono.msi" ]; then
|
||||
wget -q -O $WINEPREFIX/mono.msi https://dl.winehq.org/wine/wine-mono/9.1.0/wine-mono-9.1.0-x86.msi
|
||||
fi
|
||||
|
||||
wine msiexec /i $WINEPREFIX/mono.msi /qn /quiet /norestart /log $WINEPREFIX/mono_install.log
|
||||
wine msiexec /i $WINEPREFIX/mono.msi /qn /quiet /norestart /log $WINEPREFIX/mono_install.log
|
||||
fi
|
||||
|
||||
# List and install other packages
|
||||
for trick in $WINETRICKS_RUN; do
|
||||
echo "Installing $trick"
|
||||
winetricks -q $trick
|
||||
echo "Installing $trick"
|
||||
winetricks -q $trick
|
||||
done
|
||||
|
||||
# Replace Startup Variables
|
||||
|
||||
Reference in new issue
Block a user