diff --git a/Dockerfile b/Dockerfile index b853c5ca..16eca6ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ LABEL maintainer="thijs@loef.dev" \ ARG SUPERCRONIC_SHA1SUM_ARM64="e0f0c06ebc5627e43b25475711e694450489ab00 " ARG SUPERCRONIC_SHA1SUM_AMD64="71b0d58cc53f6bd72cf2f293e09e294b79c666d8 " ARG SUPERCRONIC_VERSION="0.2.33" -ARG DEPOT_DOWNLOADER_VERSION="2.7.4" +ARG DEPOT_DOWNLOADER_VERSION="3.0.0" # update and install dependencies # hadolint ignore=DL3008 diff --git a/scripts/helper_install.sh b/scripts/helper_install.sh index 13fe9613..92cf5ad2 100644 --- a/scripts/helper_install.sh +++ b/scripts/helper_install.sh @@ -49,6 +49,24 @@ cat > /palworld/steamapps/appmanifest_2394010.acf << EOL EOL } + +GetManifestIdDepotDownloader() { + local depotManifestDirectory="$1" + local manifestFile + manifestFile=$(find "$depotManifestDirectory" -type f -name "manifest_2394012_*.txt" | head -n 1) + + if [ -z "$manifestFile" ]; then + echo "DepotDownloader manifest file not found." + return 1 + + else + local manifestId + manifestId=$(grep -oP 'Manifest ID / date\s*:\s*\K[0-9]+' "$manifestFile") + + echo "$manifestId" + fi +} + # Returns 0 if Update Required # Returns 1 if Update NOT Required # Returns 2 if Check Failed @@ -125,51 +143,76 @@ InstallServer() { kernel_page_size=$(getconf PAGESIZE) # Check kernel page size for arm64 hosts before running steamcmd - if [ "$architecture" == "arm64" ] && [ "$kernel_page_size" != "4096" ] && [ "${USE_DEPOT_DOWNLOADER}" != true ]; then - LogWarn "WARNING: Only ARM64 hosts with 4k page size is supported when running steamcmd. Please set USE_DEPOT_DOWNLOADER to true." + if [ "$architecture" == "arm64" ] && [ "$kernel_page_size" != "4096" ]; then + LogWarn "WARNING: ARM64 host detected with non-4k page size. Forcing DepotDownloader usage." + USE_DEPOT_DOWNLOADER=true fi + UseSteamCmd() { + if [ "${1}" == "beta" ]; then + if /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login anonymous +app_update 2394010 -beta insiderprogram validate +quit; then + return 0 + fi + elif [ -n "${2}" ]; then + if /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login "${STEAM_USERNAME}" "${STEAM_PASSWORD}" +download_depot 2394010 2394012 "${2}" +quit; then + if cp -vr "/home/steam/steamcmd/linux32/steamapps/content/app_2394010/depot_2394012/." "/palworld/"; then + return 0 + fi + fi + else + if /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit; then + return 0 + fi + fi + return 1 + } + + UseDepotDownloader() { + local beta="${1}" + local manifest="${2}" + mkdir -p /palworld/steamapps/ + + if [ -n "$manifest" ]; then + DepotDownloader -app 2394010 -username "${STEAM_USERNAME}" -password "${STEAM_PASSWORD}" -depot 2394012 -manifest "$manifest" -os linux -osarch 64 -dir /palworld -validate + elif [ "$beta" == "beta" ]; then + DepotDownloader -app 2394010 -os linux -osarch 64 -dir /palworld -branch insiderprogram -validate + DepotDownloader -app 2394010 -depot 2394012 -osarch 64 -dir /palworld/.manifest -branch insiderprogram -manifest-only + manifest=$(GetManifestIdDepotDownloader "/palworld/.manifest") + else + DepotDownloader -app 2394010 -os linux -osarch 64 -dir /palworld -validate + DepotDownloader -app 2394010 -depot 2394012 -osarch 64 -dir /palworld/.manifest -manifest-only + manifest=$(GetManifestIdDepotDownloader "/palworld/.manifest") + fi + + CreateACFFile "$manifest" + rm -rf /palworld/.manifest + } + if [ -z "${TARGET_MANIFEST_ID}" ]; then DiscordMessage "Install" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE}" "in-progress" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE_ENABLED}" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE_URL}" - ## If INSTALL_BETA_INSIDER is set to true, install the latest beta version + if [ "${INSTALL_BETA_INSIDER}" == true ]; then LogWarn "Installing latest beta version" if [ "${USE_DEPOT_DOWNLOADER}" == true ]; then - LogWarn "Downloading server files using DepotDownloader" - DepotDownloader -app 2394010 -osarch 64 -dir /palworld -beta insiderprogram -validate - DepotDownloader -app 2394010 -depot 2394012 -osarch 64 -dir /tmp -beta insiderprogram -manifest-only + LogWarn "Downloading server files with DepotDownloader" + UseDepotDownloader "beta" else - /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login anonymous +app_update 2394010 -beta insiderprogram validate +quit + LogWarn "Downloading server files with SteamCMD" + if ! UseSteamCmd "beta"; then + LogWarn "SteamCMD failed, falling back to DepotDownloader" + UseDepotDownloader "beta" + fi fi else if [ "${USE_DEPOT_DOWNLOADER}" == true ]; then - LogWarn "Downloading server files using DepotDownloader" - DepotDownloader -app 2394010 -osarch 64 -dir /palworld -validate - DepotDownloader -app 2394010 -depot 2394012 -osarch 64 -dir /tmp -manifest-only - else - /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit - fi - fi - - # Create ACF file for DepoDownloader downloads for script compatibility - if [ "${USE_DEPOT_DOWNLOADER}" == true ]; then - local manifestFile - manifestFile=$(find /tmp -type f -name "manifest_2394012_*.txt" | head -n 1) - - if [ -z "$manifestFile" ]; then - echo "DepotDownloader manifest file not found." + LogWarn "Downloading server files with DepotDownloader" + UseDepotDownloader else - local manifestId - manifestId=$(grep -oP 'Manifest ID / date\s*:\s*\K[0-9]+' "$manifestFile") - - if [ -z "$manifestId" ]; then - echo "Manifest ID not found in DepotDownloader manifest file." - else - mkdir -p /palworld/steamapps - CreateACFFile "$manifestId" + LogWarn "Downloading server files with SteamCMD" + if ! UseSteamCmd; then + LogWarn "SteamCMD failed, falling back to DepotDownloader" + UseDepotDownloader fi - - rm -rf "$manifestFile" fi fi @@ -186,15 +229,21 @@ InstallServer() { DiscordMessage "Install" "STEAM_USERNAME or STEAM_PASSWORD is not set. Please set these variables to install a specific version." "failure" return 2 fi + DiscordMessage "Install" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE}" "in-progress" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE_ENABLED}" "${DISCORD_PRE_UPDATE_BOOT_MESSAGE_URL}" + if [ "${USE_DEPOT_DOWNLOADER}" == true ]; then - LogWarn "Downloading server files using DepotDownloader" - DepotDownloader -app 2394010 -username "${STEAM_USERNAME}" -password "${STEAM_PASSWORD}" -depot 2394012 -manifest "$targetManifest" -osarch 64 -dir /palworld -validate - DepotDownloader -app 2394010 -username "${STEAM_USERNAME}" -password "${STEAM_PASSWORD}" -depot 1006 -osarch 64 -dir /palworld -validate + LogWarn "Downloading server files with DepotDownloader" + UseDepotDownloader "" "$targetManifest" else - /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login "${STEAM_USERNAME}" "${STEAM_PASSWORD}" +download_depot 2394010 2394012 "$targetManifest" +quit - cp -vr "/home/steam/steamcmd/linux32/steamapps/content/app_2394010/depot_2394012/." "/palworld/" + LogWarn "Downloading server files with SteamCMD" + if ! UseSteamCmd "" "$targetManifest"; then + LogWarn "SteamCMD failed, falling back to DepotDownloader" + UseDepotDownloader "" "$targetManifest" + else + CreateACFFile "$targetManifest" + fi fi - CreateACFFile "$targetManifest" + DiscordMessage "Install" "${DISCORD_POST_UPDATE_BOOT_MESSAGE}" "success" "${DISCORD_POST_UPDATE_BOOT_MESSAGE_ENABLED}" "${DISCORD_POST_UPDATE_BOOT_MESSAGE_URL}" } diff --git a/scripts/start.sh b/scripts/start.sh index d6d4d484..8c9a7f59 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -29,32 +29,23 @@ if [ "$ServerInstalled" == 0 ] && [ "${UPDATE_ON_BOOT,,}" == true ]; then InstallServer fi +STARTCOMMAND=("./PalServer.sh") + +#Validate Installation +if ! fileExists "${STARTCOMMAND[0]}"; then + LogError "Server Not Installed Properly" + exit 1 +fi + # Check if the architecture is arm64 if [ "$architecture" == "arm64" ]; then # create an arm64 version of ./PalServer.sh - if ! fileExists "./PalServer.sh" && [ "${USE_DEPOT_DOWNLOADER,,}" != true ]; then - LogInfo "SteamCMD failed to download the server properly, attempting to use DepotDownloader." - export USE_DEPOT_DOWNLOADER=true - InstallServer - - # reset env var after installation - unset USE_DEPOT_DOWNLOADER - fi cp ./PalServer.sh ./PalServer-arm64.sh sed -i "s|\(\"\$UE_PROJECT_ROOT\/Pal\/Binaries\/Linux\/PalServer-Linux-Shipping\" Pal \"\$@\"\)|LD_LIBRARY_PATH=/home/steam/steamcmd/linux64:\$LD_LIBRARY_PATH /usr/local/bin/box64 \1|" ./PalServer-arm64.sh chmod +x ./PalServer-arm64.sh STARTCOMMAND=("./PalServer-arm64.sh") -else - STARTCOMMAND=("./PalServer.sh") -fi - - -#Validate Installation -if ! fileExists "${STARTCOMMAND[0]}"; then - LogError "Server Not Installed Properly" - exit 1 fi isReadable "${STARTCOMMAND[0]}" || exit @@ -74,7 +65,7 @@ if [ "${COMMUNITY,,}" = true ]; then fi if [ "${MULTITHREADING,,}" = true ]; then - STARTCOMMAND+=("-useperfthreads" "-NoAsyncLoadingThread" "-UseMultithreadForDS") + STARTCOMMAND+=("-useperfthreads" "-NoAsyncLoadingThread" "-UseMultithreadForDS" "-NumberOfWorkerThreadsServer=$(nproc --all)") fi LogAction "Checking for available container updates"