style: format shell scripts

This commit is contained in:
darksaid98 committed 2025-09-16 16:53:11 +02:00
1 parent 65f79fe387
commit c410367d3b
20 files changed
+332 -348

No files matched your search

+4 -1
View File
@@ -30,7 +30,10 @@ echo -e "${YELLOW}:/home/container${NC} ${MODIFIED_STARTUP}"
echo -e "${BLUE}-------------------------------------------------${NC}" echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${YELLOW}starting MongoDB...${NC}" echo -e "${YELLOW}starting MongoDB...${NC}"
echo -e "${BLUE}-------------------------------------------------${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 # Run the Server
echo -e "${BLUE}-------------------------------------------------${NC}" echo -e "${BLUE}-------------------------------------------------${NC}"
+1 -1
View File
@@ -6,7 +6,7 @@ INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP export INTERNAL_IP
# Replace Startup Variables # 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}" echo ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server # Run the Server
+1 -2
View File
@@ -5,9 +5,8 @@ cd /home/container
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP export INTERNAL_IP
# Replace Startup Variables # 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}" echo ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server # Run the Server
+1 -2
View File
@@ -2,8 +2,7 @@
cd /home/container cd /home/container
# Make internal Docker IP address available to processes. # 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 # Replace Startup Variables
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
+5 -7
View File
@@ -15,15 +15,13 @@ cd /home/container || exit 1
printf "\033[1m\033[33mcontainer@pelican~ \033[0mjava -version\n" printf "\033[1m\033[33mcontainer@pelican~ \033[0mjava -version\n"
java -version java -version
# Print Python version # Print Python version
if command -v python &> /dev/null if command -v python &>/dev/null; then
then printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython --version\n"
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython --version\n" python --version
python --version
else else
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython3 --version\n" printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython3 --version\n"
python3 --version python3 --version
fi fi
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell # Convert all of the "{{VARIABLE}}" parts of the command into the expected shell
+2 -2
View File
@@ -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-)" GIT_ADDRESS="https://${GIT_USERNAME}:${GIT_ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
fi fi
# Update # Update
if [ "$(ls -A /home/container)" ]; then if [ "$(ls -A /home/container)" ]; then
echo -e "/home/container directory is not empty." 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 git origin matches the repo specified by user then pull
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
echo "Pulling changes from Git." 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 fi
else else
# No files exist in resources folder, clone # No files exist in resources folder, clone
+31 -38
View File
@@ -7,11 +7,11 @@
## License: MIT License ## License: MIT License
## === CONSTANTS === ## === CONSTANTS ===
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD 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. 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) 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 # Color Codes
CYAN='\033[0;36m' CYAN='\033[0;36m'
@@ -36,11 +36,11 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
fi fi
updateAttempt=0 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 # 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" echo -e "\t${YELLOW}Re-Attempting download/update in 3 seconds...${NC} (Attempt ${CYAN}${updateAttempt}${NC} of ${CYAN}${STEAMCMD_ATTEMPTS}${NC})\n"
sleep 3 sleep 3
fi 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" echo -e "\t${YELLOW}(Please contact your administrator/host for support)${NC}\n"
cp -r /tmp/dumps /home/container/dumps cp -r /tmp/dumps /home/container/dumps
exit $steamcmdExitCode exit $steamcmdExitCode
else # Success! else # Success!
if [[ $1 == 0 ]]; then # Server if [[ $1 == 0 ]]; then # Server
echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}" echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}"
else # Mod 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} cp $file ./keys/optional_$2_${filename}
done; done
echo -e "\tMod with ID $2 is an optional mod. Deleting original mod download folder..." echo -e "\tMod with ID $2 is an optional mod. Deleting original mod download folder..."
rm -r ./@$2 rm -r ./@$2
@@ -137,8 +137,8 @@ function RunSteamCMD { #[Input: int server=0 mod=1 optional_mod=2; int id]
fi fi
break break
fi fi
if (( $updateAttempt == $STEAMCMD_ATTEMPTS )); then # Notify if failed last attempt if (($updateAttempt == $STEAMCMD_ATTEMPTS)); then # Notify if failed last attempt
if [[ $1 == 0 ]]; then # Server 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${RED}Final attempt made! ${YELLOW}Unable to complete game server update. ${CYAN}Skipping...${NC}"
echo -e "\t(Please try again at a later time)" echo -e "\t(Please try again at a later time)"
sleep 3 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. # Takes a directory (string) as input, and recursively makes all files & folders lowercase.
function ModsLowercase { function ModsLowercase {
echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..." echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..."
for SRC in `find ./$1 -depth` for SRC in $(find ./$1 -depth); do
do DST=$(dirname "${SRC}")/$(basename "${SRC}" | tr '[A-Z]' '[a-z]')
DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'` if [ "${SRC}" != "${DST}" ]; then
if [ "${SRC}" != "${DST}" ]
then
[ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}"
fi fi
done done
@@ -166,7 +164,7 @@ function ModsLowercase {
# Removes duplicate items from a semicolon delimited string # Removes duplicate items from a semicolon delimited string
function RemoveDuplicates { #[Input: str - Output: printf of new str] 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;' echo $1 | sed -e 's/;/\n/g' | sort -u | xargs printf '%s;'
fi fi
} }
@@ -218,10 +216,10 @@ if [[ -n ${OPTIONALMODS} ]] && [[ ${OPTIONALMODS} != *\; ]]; then # Add specifie
else else
allMods+=${OPTIONALMODS} allMods+=${OPTIONALMODS}
fi 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 CLIENT_MODS=$(RemoveDuplicates ${CLIENT_MODS}) # Remove duplicate mods from CLIENT_MODS, if present
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, 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=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
# Update everything (server and mods), if specified # Update everything (server and mods), if specified
if [[ ${UPDATE_SERVER} == 1 ]]; then if [[ ${UPDATE_SERVER} == 1 ]]; then
@@ -255,8 +253,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
## Update mods ## Update mods
if [[ -n $allMods ]] && [[ ${DISABLE_MOD_UPDATES} != 1 ]]; then if [[ -n $allMods ]] && [[ ${DISABLE_MOD_UPDATES} != 1 ]]; then
echo -e "\n${GREEN}[UPDATE]:${NC} Checking all ${CYAN}Steam Workshop mods${NC} for updates..." echo -e "\n${GREEN}[UPDATE]:${NC} Checking all ${CYAN}Steam Workshop mods${NC} for updates..."
for modID in $(echo $allMods | sed -e 's/@//g') for modID in $(echo $allMods | sed -e 's/@//g'); do
do
if [[ $modID =~ ^[0-9]+$ ]]; then # Only check mods that are in ID-form 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 # 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 # 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) 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 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 # 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) 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 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 # Delete the optional mod .bikey file and directory
rm ${keyFile} rm ${keyFile}
rmdir ./@${modID}_optional 2> /dev/null rmdir ./@${modID}_optional 2>/dev/null
fi fi
fi fi
done; done
echo -e "${GREEN}[UPDATE]:${NC} Steam Workshop mod update check ${GREEN}complete${NC}!" echo -e "${GREEN}[UPDATE]:${NC} Steam Workshop mod update check ${GREEN}complete${NC}!"
fi fi
@@ -340,8 +337,7 @@ fi
# Make mods lowercase, if specified # Make mods lowercase, if specified
if [[ ${MODS_LOWERCASE} == "1" ]]; then if [[ ${MODS_LOWERCASE} == "1" ]]; then
for modDir in $allMods for modDir in $allMods; do
do
ModsLowercase $modDir ModsLowercase $modDir
done done
fi fi
@@ -355,8 +351,7 @@ mkdir -p /home/container/serverprofile/rpt
# Clear HC cache, if specified # Clear HC cache, if specified
if [[ ${CLEAR_CACHE} == "1" ]]; then if [[ ${CLEAR_CACHE} == "1" ]]; then
echo -e "\n${GREEN}[STARTUP]: ${CYAN}Clearing Headless Client profiles cache...${NC}" echo -e "\n${GREEN}[STARTUP]: ${CYAN}Clearing Headless Client profiles cache...${NC}"
for profileDir in ./serverprofile/home/* for profileDir in ./serverprofile/home/*; do
do
[ "$profileDir" = "./serverprofile/home/Player" ] && continue [ "$profileDir" = "./serverprofile/home/Player" ] && continue
rm -rf $profileDir rm -rf $profileDir
done done
@@ -372,7 +367,7 @@ fi
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile) # Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
export USER_ID=$(id -u) export USER_ID=$(id -u)
export GROUP_ID=$(id -g) 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 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 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
@@ -381,16 +376,14 @@ else
fi fi
# Replace Startup Variables # 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 # Start Headless Clients if applicable
if [[ ${HC_NUM} > 0 ]]; then if [[ ${HC_NUM} > 0 ]]; then
echo -e "\n${GREEN}[STARTUP]:${NC} Starting ${CYAN}${HC_NUM}${NC} Headless Client(s)." echo -e "\n${GREEN}[STARTUP]:${NC} Starting ${CYAN}${HC_NUM}${NC} Headless Client(s)."
for i in $(seq ${HC_NUM}) for i in $(seq ${HC_NUM}); do
do if [[ ${HC_HIDE} == "1" ]]; then
if [[ ${HC_HIDE} == "1" ]]; ./${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 &
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 else
./${SERVER_BINARY} -client -connect=127.0.0.1 -port=${SERVER_PORT} -password="${SERVER_PASSWORD}" -profiles=./serverprofile -bepath=./battleye -mod="${CLIENT_MODS}" ${STARTUP_PARAMS} & ./${SERVER_BINARY} -client -connect=127.0.0.1 -port=${SERVER_PORT} -password="${SERVER_PASSWORD}" -profiles=./serverprofile -bepath=./battleye -mod="${CLIENT_MODS}" ${STARTUP_PARAMS} &
fi fi
@@ -402,7 +395,7 @@ fi
echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:" echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:"
echo -e "${CYAN}${modifiedStartup}${NC}\n" echo -e "${CYAN}${modifiedStartup}${NC}\n"
if [[ "$STARTUP_PARAMS" == *"-noLogs"* ]]; then if [[ "$STARTUP_PARAMS" == *"-noLogs"* ]]; then
${modifiedStartup} ${modifiedStartup}
else else
${modifiedStartup} 2>&1 | tee -a "$LOG_FILE" ${modifiedStartup} 2>&1 | tee -a "$LOG_FILE"
fi fi
+22 -26
View File
@@ -7,10 +7,10 @@
## License: MIT License ## License: MIT License
## === CONSTANTS === ## === CONSTANTS ===
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD 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. GAME_ID=221100 # SteamCMD ID for the DayZ GAME (not server). Only used for Workshop mod downloads.
# Color Codes # Color Codes
CYAN='\033[0;36m' CYAN='\033[0;36m'
@@ -35,11 +35,11 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
fi fi
updateAttempt=0 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 # 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" echo -e "\t${YELLOW}Re-Attempting download/update in 3 seconds...${NC} (Attempt ${CYAN}${updateAttempt}${NC} of ${CYAN}${STEAMCMD_ATTEMPTS}${NC})\n"
sleep 3 sleep 3
fi fi
@@ -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" echo -e "\t${YELLOW}(Please contact your administrator/host for support)${NC}\n"
cp -r /tmp/dumps /home/container/dumps cp -r /tmp/dumps /home/container/dumps
exit $steamcmdExitCode exit $steamcmdExitCode
else # Success! else # Success!
if [[ $1 == 0 ]]; then # Server if [[ $1 == 0 ]]; then # Server
echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}" echo -e "\n${GREEN}[UPDATE]: Game server is up to date!${NC}"
else # Mod else # Mod
@@ -116,8 +116,8 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
fi fi
break break
fi fi
if (( $updateAttempt == $STEAMCMD_ATTEMPTS )); then # Notify if failed last attempt if (($updateAttempt == $STEAMCMD_ATTEMPTS)); then # Notify if failed last attempt
if [[ $1 == 0 ]]; then # Server 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${RED}Final attempt made! ${YELLOW}Unable to complete game server update. ${CYAN}Skipping...${NC}"
echo -e "\t(Please try again at a later time)" echo -e "\t(Please try again at a later time)"
sleep 3 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. # Takes a directory (string) as input, and recursively makes all files & folders lowercase.
function ModsLowercase { function ModsLowercase {
echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..." echo -e "\n\tMaking mod ${CYAN}$1${NC} files/folders lowercase..."
for SRC in `find ./$1 -depth` for SRC in $(find ./$1 -depth); do
do DST=$(dirname "${SRC}")/$(basename "${SRC}" | tr '[A-Z]' '[a-z]')
DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'` if [ "${SRC}" != "${DST}" ]; then
if [ "${SRC}" != "${DST}" ]
then
[ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}"
fi fi
done done
@@ -145,7 +143,7 @@ function ModsLowercase {
# Removes duplicate items from a semicolon delimited string # Removes duplicate items from a semicolon delimited string
function RemoveDuplicates { #[Input: str - Output: printf of new str] 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;' echo $1 | sed -e 's/;/\n/g' | sort -u | xargs printf '%s;'
fi fi
} }
@@ -185,10 +183,10 @@ if [[ -n ${SERVERMODS} ]] && [[ ${SERVERMODS} != *\; ]]; then
else else
allMods=${SERVERMODS} allMods=${SERVERMODS}
fi 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 CLIENT_MODS=$(RemoveDuplicates ${CLIENT_MODS}) # Remove duplicate mods from CLIENT_MODS, if present
allMods=$(RemoveDuplicates ${allMods}) # Remove duplicate mods from allMods, 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=$(echo $allMods | sed -e 's/;/ /g') # Convert from string to array
# Update everything (server and mods), if specified # Update everything (server and mods), if specified
if [[ ${UPDATE_SERVER} == 1 ]]; then if [[ ${UPDATE_SERVER} == 1 ]]; then
@@ -219,13 +217,12 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
## Update mods ## Update mods
if [[ -n $allMods ]] && [[ ${DISABLE_MOD_UPDATES} != 1 ]]; then if [[ -n $allMods ]] && [[ ${DISABLE_MOD_UPDATES} != 1 ]]; then
echo -e "\n${GREEN}[UPDATE]:${NC} Checking all ${CYAN}Steam Workshop mods${NC} for updates..." echo -e "\n${GREEN}[UPDATE]:${NC} Checking all ${CYAN}Steam Workshop mods${NC} for updates..."
for modID in $(echo $allMods | sed -e 's/@//g') for modID in $(echo $allMods | sed -e 's/@//g'); do
do
if [[ $modID =~ ^[0-9]+$ ]]; then # Only check mods that are in ID-form 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 # 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) 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 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 # 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) 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 if [[ -z $modName ]]; then # Set default name if unavailable
@@ -265,8 +262,7 @@ fi
# Make mods lowercase, if specified # Make mods lowercase, if specified
if [[ ${MODS_LOWERCASE} == "1" ]]; then if [[ ${MODS_LOWERCASE} == "1" ]]; then
for modDir in $allMods for modDir in $allMods; do
do
ModsLowercase $modDir ModsLowercase $modDir
done done
fi fi
@@ -274,11 +270,11 @@ fi
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile) # Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
export USER_ID=$(id -u) export USER_ID=$(id -u)
export GROUP_ID=$(id -g) 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 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
# Replace Startup Variables # 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 # Start the Server
echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:" echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:"
+14 -14
View File
@@ -15,34 +15,34 @@ ENV USER=container HOME=/home/container
## Update base packages ## Update base packages
RUN apt update \ RUN apt update \
&& apt upgrade -y && apt upgrade -y
## Install dependencies ## 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 \ 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 \ 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 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 # Temp fix for libicu66.1 for RAGE-MP and libssl1.1 for fivem and many more
RUN if [ "$(uname -m)" = "x86_64" ]; then \ 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/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 && \ 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 libicu66_66.1-2ubuntu2.1_amd64.deb && \
dpkg -i libssl1.1_1.1.0g-2ubuntu4_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; \ rm libicu66_66.1-2ubuntu2.1_amd64.deb libssl1.1_1.1.0g-2ubuntu4_amd64.deb; \
fi fi
# ARM64 # ARM64
RUN if [ ! "$(uname -m)" = "x86_64" ]; then \ RUN if [ ! "$(uname -m)" = "x86_64" ]; then \
wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \ 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 && \ dpkg -i libssl1.1_1.1.1f-1ubuntu2_arm64.deb && \
rm libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \ rm libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \
fi fi
## Configure Git Lfs ## Configure Git Lfs
RUN git lfs install RUN git lfs install
## Configure locale ## Configure locale
RUN update-locale lang=en_US.UTF-8 \ RUN update-locale lang=en_US.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales && dpkg-reconfigure --frontend noninteractive locales
WORKDIR /home/container WORKDIR /home/container
+39 -39
View File
@@ -4,52 +4,52 @@ cd /home/container
# Auto update resources from git. # Auto update resources from git.
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
# Pre git stuff # Pre git stuff
echo "Wait, preparing to pull or clone from git."; echo "Wait, preparing to pull or clone from git."
mkdir -p /home/container/resources mkdir -p /home/container/resources
cd /home/container/resources cd /home/container/resources
# Git stuff # Git stuff
if [[ ${GIT_REPOURL} != *.git ]]; then # Add .git at end of URL if [[ ${GIT_REPOURL} != *.git ]]; then # Add .git at end of URL
GIT_REPOURL=${GIT_REPOURL}.git 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
fi fi
# If git origin matches the repo specified by user then pull if [ -z "${GIT_USERNAME}" ] && [ -z "${GIT_TOKEN}" ]; then # Check for git username & token
if [ "${GIT_ORIGIN}" == "${GIT_REPOURL}" ]; then # echo -e "git Username or git Token was not specified."
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 else
echo -e "Cloning ${GIT_BRANCH} branch into /home/container/resources/." GIT_REPOURL="https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo -e ${GIT_REPOURL} | cut -d/ -f3-)"
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
fi
# Post git stuff if [ "$(ls -A /home/container/resources)" ]; then # Files exist in resources folder, pull
cd /home/container 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 fi
# Make internal Docker IP address available to processes. # Make internal Docker IP address available to processes.
+4 -4
View File
@@ -2,18 +2,18 @@
cd /home/container cd /home/container
# Make internal Docker IP address available to processes. # 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 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
# Allow for the staging branch to also update itself # 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 else
echo -e "Not updating game server as auto update was set to 0. Starting Server" echo -e "Not updating game server as auto update was set to 0. Starting Server"
fi fi
# Replace Startup Variables # 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}" echo ":/home/container$ ${MODIFIED_STARTUP}"
if [[ "${FRAMEWORK}" == "carbon" ]]; then if [[ "${FRAMEWORK}" == "carbon" ]]; then
@@ -34,7 +34,7 @@ elif [[ "${FRAMEWORK}" == "oxide-staging" ]]; then
elif [[ "$OXIDE" == "1" ]] || [[ "${FRAMEWORK}" == "oxide" ]]; then elif [[ "$OXIDE" == "1" ]] || [[ "${FRAMEWORK}" == "oxide" ]]; then
# Oxide: https://github.com/OxideMod/Oxide.Rust # Oxide: https://github.com/OxideMod/Oxide.Rust
echo "Updating uMod..." 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 unzip -o -q umod.zip
rm umod.zip rm umod.zip
echo "Done updating uMod!" echo "Done updating uMod!"
+1 -1
View File
@@ -2,7 +2,7 @@
cd /home/container cd /home/container
# Make internal Docker IP address available to processes. # 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 # Replace Startup Variables
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
+5 -6
View File
@@ -36,7 +36,6 @@ export INTERNAL_IP
# Switch to the container's working directory # Switch to the container's working directory
cd /home/container || exit 1 cd /home/container || exit 1
## just in case someone removed the defaults. ## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then if [ "${STEAM_USER}" == "" ]; then
echo -e "steam user is not set.\n" echo -e "steam user is not set.\n"
@@ -52,11 +51,11 @@ fi
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server # Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; 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 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 fi
else else
echo -e "No appid set. Starting Server" echo -e "No appid set. Starting Server"
fi fi
+2 -4
View File
@@ -5,7 +5,6 @@ cd /home/container
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP export INTERNAL_IP
## just in case someone removed the defaults. ## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then if [ "${STEAM_USER}" == "" ]; then
echo -e "steam user is not set.\n" echo -e "steam user is not set.\n"
@@ -21,7 +20,7 @@ fi
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server # Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then 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 else
echo -e "No appid set. Starting Server" echo -e "No appid set. Starting Server"
fi fi
@@ -30,11 +29,10 @@ else
echo -e "Not updating game server as auto update was set to 0. Starting Server" echo -e "Not updating game server as auto update was set to 0. Starting Server"
fi fi
# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile) # Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile)
export USER_ID=$(id -u) export USER_ID=$(id -u)
export GROUP_ID=$(id -g) 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 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
+162 -162
View File
@@ -38,237 +38,237 @@ DEFAULT_BRANCH="main"
# Normalize repository URL # Normalize repository URL
normalize_repo_url() { normalize_repo_url() {
local url="$1" local url="$1"
# Remove any existing credentials (user:token@) # Remove any existing credentials (user:token@)
url=$(echo "$url" | sed 's|https://[^@]*@|https://|') url=$(echo "$url" | sed 's|https://[^@]*@|https://|')
# Add .git suffix if not present # Add .git suffix if not present
if [[ "$url" != *.git ]]; then if [[ "$url" != *.git ]]; then
url="${url}.git" url="${url}.git"
fi fi
echo "$url" echo "$url"
} }
# Construct authenticated URL # Construct authenticated URL
construct_auth_url() { construct_auth_url() {
local repo_url="$1" local repo_url="$1"
local username="$2" local username="$2"
local token="$3" local token="$3"
# Remove https:// prefix # Remove https:// prefix
repo_url="${repo_url#https://}" repo_url="${repo_url#https://}"
# Construct authenticated URL # Construct authenticated URL
echo "https://${username}:${token}@${repo_url}" echo "https://${username}:${token}@${repo_url}"
} }
# Extract repository info for logging # Extract repository info for logging
get_repo_info() { get_repo_info() {
local url="$1" local url="$1"
local normalized_url=$(normalize_repo_url "$url") local normalized_url=$(normalize_repo_url "$url")
# Extract owner/repo from URL # Extract owner/repo from URL
local repo_path=$(echo "$normalized_url" | sed 's|https://github.com/||' | sed 's|\.git$||') local repo_path=$(echo "$normalized_url" | sed 's|https://github.com/||' | sed 's|\.git$||')
echo "$repo_path" echo "$repo_path"
} }
# Check if current directory is a git repository # Check if current directory is a git repository
is_git_repo() { is_git_repo() {
[ -d ".git" ] && [ -f ".git/config" ] [ -d ".git" ] && [ -f ".git/config" ]
} }
# Check if repository URLs match (ignores credentials) # Check if repository URLs match (ignores credentials)
urls_match() { urls_match() {
local url1="$1" local url1="$1"
local url2="$2" local url2="$2"
local normalized1=$(normalize_repo_url "$url1") local normalized1=$(normalize_repo_url "$url1")
local normalized2=$(normalize_repo_url "$url2") 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 git remote URL with new credentials (needed for when a user switches PAT's)
update_remote_url() { update_remote_url() {
local new_url="$1" local new_url="$1"
echo "Updating remote URL with new credentials..." echo "Updating remote URL with new credentials..."
git remote set-url origin "$new_url" git remote set-url origin "$new_url"
echo "Remote URL updated successfully" echo "Remote URL updated successfully"
} }
# Apply updates for custom repo # Apply updates for custom repo
perform_git_update() { perform_git_update() {
local branch="$1" local branch="$1"
local repo_info="$2" local repo_info="$2"
echo "" echo ""
echo "Fetching latest changes from remote..." echo "Fetching latest changes from remote..."
# Check if we have a shallow clone # Check if we have a shallow clone
local is_shallow=$(git rev-parse --is-shallow-repository 2>/dev/null || echo "false") local is_shallow=$(git rev-parse --is-shallow-repository 2>/dev/null || echo "false")
# Switch branches if necessary # Switch branches if necessary
local current_branch=$(git branch --show-current 2>/dev/null || echo "") local current_branch=$(git branch --show-current 2>/dev/null || echo "")
# Check if we need to switch branches # Check if we need to switch branches
if [ "$current_branch" != "$branch" ]; then if [ "$current_branch" != "$branch" ]; then
echo "Adding remote branch reference for '$branch'..." echo "Adding remote branch reference for '$branch'..."
git remote set-branches --add origin "$branch" git remote set-branches --add origin "$branch"
fi fi
# Fetch based on whether it's shallow or not # Fetch based on whether it's shallow or not
if [ "$is_shallow" = "true" ]; then if [ "$is_shallow" = "true" ]; then
echo "Detected shallow repository, fetching with depth 1..." echo "Detected shallow repository, fetching with depth 1..."
git fetch --depth 1 origin "$branch" git fetch --depth 1 origin "$branch"
else else
echo "Fetching full history..." echo "Fetching full history..."
git fetch origin "$branch" git fetch origin "$branch"
fi fi
echo "Updating local files to match remote branch..." echo "Updating local files to match remote branch..."
if [ "$current_branch" != "$branch" ]; then if [ "$current_branch" != "$branch" ]; then
echo "Switching from branch '$current_branch' to '$branch'..." echo "Switching from branch '$current_branch' to '$branch'..."
# Check if local branch exists # Check if local branch exists
if git show-ref --verify --quiet "refs/heads/$branch"; then if git show-ref --verify --quiet "refs/heads/$branch"; then
echo "Local branch '$branch' exists, checking out..." echo "Local branch '$branch' exists, checking out..."
git checkout "$branch" git checkout "$branch"
else else
echo "Creating and checking out new local branch '$branch'..." echo "Creating and checking out new local branch '$branch'..."
git checkout -b "$branch" "origin/$branch" git checkout -b "$branch" "origin/$branch"
fi fi
fi fi
# Deploy changes # Deploy changes
echo "Updating local files to match remote branch..." echo "Updating local files to match remote branch..."
git reset --hard "origin/$branch" git reset --hard "origin/$branch"
# Get latest commit info for logging # Get latest commit info for logging
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown") local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
echo "" echo ""
echo "✅ Successfully updated repository!" echo "✅ Successfully updated repository!"
echo "Repository: $repo_info" echo "Repository: $repo_info"
echo "Branch: $branch" echo "Branch: $branch"
echo "Latest commit: $latest_commit" echo "Latest commit: $latest_commit"
} }
# Clone custom repo # Clone custom repo
perform_git_clone() { perform_git_clone() {
local repo_url="$1" local repo_url="$1"
local branch="$2" local branch="$2"
local repo_info="$3" local repo_info="$3"
echo "" echo ""
echo "Cloning repository into container directory..." echo "Cloning repository into container directory..."
if [ -z "$branch" ]; then if [ -z "$branch" ]; then
echo "Cloning default branch..." echo "Cloning default branch..."
git clone --single-branch --depth 1 "$repo_url" . git clone --single-branch --depth 1 "$repo_url" .
else else
echo "Cloning branch: $branch" echo "Cloning branch: $branch"
git clone --single-branch --branch "$branch" --depth 1 "$repo_url" . git clone --single-branch --branch "$branch" --depth 1 "$repo_url" .
fi fi
# Get current branch and latest commit for logging # Get current branch and latest commit for logging
local current_branch=$(git branch --show-current 2>/dev/null || echo "unknown") local current_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown") local latest_commit=$(git log -1 --oneline 2>/dev/null || echo "unknown")
echo "" echo ""
echo "✅ Successfully cloned repository!" echo "✅ Successfully cloned repository!"
echo "Repository: $repo_info" echo "Repository: $repo_info"
echo "Branch: $current_branch" echo "Branch: $current_branch"
echo "Latest commit: $latest_commit" echo "Latest commit: $latest_commit"
} }
# Auto update server from git. # Auto update server from git.
perform_git_logic() { perform_git_logic() {
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
echo "Git auto-update is enabled" echo "Git auto-update is enabled"
echo "" echo ""
# Validate variables # Validate variables
if [ -z "${GIT_REPOURL}" ]; then if [ -z "${GIT_REPOURL}" ]; then
echo "❌ Error: GIT_REPOURL is not specified" echo "❌ Error: GIT_REPOURL is not specified"
exit 1 exit 1
fi fi
if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then
echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified" echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified"
echo " Both are required for private repository access" echo " Both are required for private repository access"
exit 1 exit 1
fi fi
local normalized_repo_url=$(normalize_repo_url "$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 auth_repo_url=$(construct_auth_url "$normalized_repo_url" "$GIT_USERNAME" "$GIT_TOKEN")
local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}" local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}"
local repo_info=$(get_repo_info "$GIT_REPOURL") local repo_info=$(get_repo_info "$GIT_REPOURL")
echo "Git Configuration:" echo "Git Configuration:"
echo " Repository: $repo_info" echo " Repository: $repo_info"
echo " Branch: $branch" echo " Branch: $branch"
echo " Target directory: $CONTAINER_DIR" echo " Target directory: $CONTAINER_DIR"
# Check if directory has content # Check if directory has content
if [ "$(ls -A .)" ]; then if [ "$(ls -A .)" ]; then
echo "" echo ""
echo "Container directory is not empty, checking for existing repository..." echo "Container directory is not empty, checking for existing repository..."
if is_git_repo; then if is_git_repo; then
echo "Found existing git repository" echo "Found existing git repository"
# Get current remote URL # Get current remote URL
local current_remote=$(git config --get remote.origin.url 2>/dev/null || echo "") local current_remote=$(git config --get remote.origin.url 2>/dev/null || echo "")
if [ -n "$current_remote" ]; then if [ -n "$current_remote" ]; then
echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')" echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')"
# Check if URLs match (ignoring credentials) # Check if URLs match (ignoring credentials)
if urls_match "$current_remote" "$normalized_repo_url"; then if urls_match "$current_remote" "$normalized_repo_url"; then
echo "Repository URLs match" echo "Repository URLs match"
# Update remote URL with new credentials (handles PAT changes) # Update remote URL with new credentials (handles PAT changes)
update_remote_url "$auth_repo_url" update_remote_url "$auth_repo_url"
# Perform update # Perform update
perform_git_update "$branch" "$repo_info" perform_git_update "$branch" "$repo_info"
else else
echo "❌ Repository mismatch!" echo "❌ Repository mismatch!"
echo " Expected: $repo_info" echo " Expected: $repo_info"
echo " Found: $(get_repo_info "$current_remote")" echo " Found: $(get_repo_info "$current_remote")"
echo "" echo ""
exit 1 exit 1
fi fi
else else
echo "Could not determine current remote URL" echo "Could not determine current remote URL"
exit 1 exit 1
fi fi
else else
echo "Directory contains files but is not a git repository" echo "Directory contains files but is not a git repository"
perform_git_clone "$auth_repo_url" "$branch" "$repo_info" perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
fi fi
else else
echo "" echo ""
echo "Container directory is empty, performing initial clone..." echo "Container directory is empty, performing initial clone..."
perform_git_clone "$auth_repo_url" "$branch" "$repo_info" perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
fi fi
echo "" echo ""
echo "✅ Git auto-update completed successfully!" echo "✅ Git auto-update completed successfully!"
echo "Working directory: $(pwd)" echo "Working directory: $(pwd)"
# Final verification # Final verification
if is_git_repo; then if is_git_repo; then
local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown") local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "Current branch: $final_branch" echo "Current branch: $final_branch"
fi fi
# Post git stuff # Post git stuff
cd /home/container cd /home/container
fi fi
} }
perform_git_logic perform_git_logic
+2 -3
View File
@@ -30,9 +30,9 @@ if [ ! -z "${SRCDS_APPID}" ]; then
# Update Source Server # Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; 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 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 fi
else else
echo -e "No appid set. Starting Server" echo -e "No appid set. Starting Server"
@@ -43,7 +43,6 @@ if [ ! -z "${SRCDS_APPID}" ]; then
fi fi
fi fi
# Replace Startup Variables # Replace Startup Variables
MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}" echo -e ":/home/container$ ${MODIFIED_STARTUP}"
+1 -1
View File
@@ -9,7 +9,7 @@ INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP export INTERNAL_IP
# Replace Startup Variables # 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}" echo ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server # Run the Server
+7 -7
View File
@@ -36,7 +36,7 @@ export INTERNAL_IP
# Set environment for Steam Proton # Set environment for Steam Proton
if [ -f "/usr/local/bin/proton" ]; then if [ -f "/usr/local/bin/proton" ]; then
if [ ! -z ${SRCDS_APPID} ]; 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_CLIENT_INSTALL_PATH="/home/container/.steam/steam"
export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}" export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
# Fix for pipx with protontricks # Fix for pipx with protontricks
@@ -47,7 +47,7 @@ if [ -f "/usr/local/bin/proton" ]; then
echo -e "Server stops now" echo -e "Server stops now"
echo -e "----------------------------------------------------------------------------------" echo -e "----------------------------------------------------------------------------------"
exit 0 exit 0
fi fi
fi fi
# Switch to the container's working directory # Switch to the container's working directory
@@ -68,11 +68,11 @@ fi
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server # Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; 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 ./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 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 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 fi
else else
echo -e "No appid set. Starting Server" echo -e "No appid set. Starting Server"
fi fi
+4 -4
View File
@@ -9,7 +9,7 @@ log() {
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOGFILE echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOGFILE
} }
install_dep(){ install_dep() {
log "Installing dependencies..." log "Installing dependencies..."
apt update && apt -y install \ apt update && apt -y install \
build-essential \ build-essential \
@@ -73,7 +73,7 @@ install_arm64_multilib() {
log "Multilib ARM64 installed successfully" log "Multilib ARM64 installed successfully"
} }
clone_mumble(){ clone_mumble() {
log "Cloning the Mumble repository..." log "Cloning the Mumble repository..."
# Create the necessary directories # Create the necessary directories
@@ -105,7 +105,7 @@ clone_mumble(){
# Create and navigate to the build directory # Create and navigate to the build directory
mkdir -p build && cd build mkdir -p build && cd build
echo "$LATEST_TAG" > latest_tag.txt echo "$LATEST_TAG" >latest_tag.txt
# Run cmake with the specified options # Run cmake with the specified options
cmake -Dbundled-opus=OFF -Dclient=OFF -Dstatic=ON -DCMAKE_BUILD_TYPE=Release .. cmake -Dbundled-opus=OFF -Dclient=OFF -Dstatic=ON -DCMAKE_BUILD_TYPE=Release ..
@@ -117,7 +117,7 @@ clone_mumble(){
log "Repository cloned and configured successfully" log "Repository cloned and configured successfully"
} }
build_mumble(){ build_mumble() {
log "Building Mumble server..." log "Building Mumble server..."
cd /usr/src/mumble/git/build cd /usr/src/mumble/git/build
+24 -24
View File
@@ -25,11 +25,11 @@ fi
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server # Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; 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 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 fi
else else
echo -e "No appid set. Starting Server" echo -e "No appid set. Starting Server"
fi fi
@@ -39,7 +39,7 @@ else
fi fi
if [[ $XVFB == 1 ]]; then 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 fi
# Install necessary to run packages # Install necessary to run packages
@@ -49,37 +49,37 @@ mkdir -p $WINEPREFIX
# Check if wine-gecko required and install it if so # Check if wine-gecko required and install it if so
if [[ $WINETRICKS_RUN =~ gecko ]]; then if [[ $WINETRICKS_RUN =~ gecko ]]; then
echo "Installing Gecko" echo "Installing Gecko"
WINETRICKS_RUN=${WINETRICKS_RUN/gecko} WINETRICKS_RUN=${WINETRICKS_RUN/gecko/}
if [ ! -f "$WINEPREFIX/gecko_x86.msi" ]; then 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 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 fi
if [ ! -f "$WINEPREFIX/gecko_x86_64.msi" ]; then 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 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 fi
wine msiexec /i $WINEPREFIX/gecko_x86.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_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 wine msiexec /i $WINEPREFIX/gecko_x86_64.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_64_install.log
fi fi
# Check if wine-mono required and install it if so # Check if wine-mono required and install it if so
if [[ $WINETRICKS_RUN =~ mono ]]; then if [[ $WINETRICKS_RUN =~ mono ]]; then
echo "Installing mono" echo "Installing mono"
WINETRICKS_RUN=${WINETRICKS_RUN/mono} WINETRICKS_RUN=${WINETRICKS_RUN/mono/}
if [ ! -f "$WINEPREFIX/mono.msi" ]; then 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 wget -q -O $WINEPREFIX/mono.msi https://dl.winehq.org/wine/wine-mono/9.1.0/wine-mono-9.1.0-x86.msi
fi 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 fi
# List and install other packages # List and install other packages
for trick in $WINETRICKS_RUN; do for trick in $WINETRICKS_RUN; do
echo "Installing $trick" echo "Installing $trick"
winetricks -q $trick winetricks -q $trick
done done
# Replace Startup Variables # Replace Startup Variables