style: format shell scripts

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

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 "${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}"
+1 -1
View File
@@ -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
+1 -2
View File
@@ -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
+1 -2
View File
@@ -2,8 +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')
+1 -3
View File
@@ -15,10 +15,8 @@ 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
if command -v python &>/dev/null; then
printf "\033[1m\033[33mcontainer@pelican~ \033[0mpython --version\n"
python --version
else
+11 -18
View File
@@ -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
@@ -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
@@ -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
@@ -322,7 +319,7 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
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
@@ -381,15 +376,13 @@ 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
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} &
+6 -10
View File
@@ -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
@@ -219,8 +217,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
# 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)
@@ -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
@@ -278,7 +274,7 @@ 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:"
+1 -1
View File
@@ -5,7 +5,7 @@ cd /home/container
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
# 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
cd /home/container/resources
+2 -2
View File
@@ -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}')
## if auto_update is not set or to 1 update
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
@@ -13,7 +13,7 @@ else
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
+1 -1
View File
@@ -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')
-1
View File
@@ -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"
-2
View File
@@ -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"
@@ -30,7 +29,6 @@ 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)
-1
View File
@@ -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}"
+1 -1
View File
@@ -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
+2 -2
View File
@@ -50,7 +50,7 @@ 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}
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
@@ -67,7 +67,7 @@ fi
# Check if wine-mono required and install it if so
if [[ $WINETRICKS_RUN =~ mono ]]; then
echo "Installing mono"
WINETRICKS_RUN=${WINETRICKS_RUN/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