diff --git a/modserver/old/modlists/chernarus.txt b/modserver/old/modlists/chernarus.txt new file mode 100644 index 0000000..ac07965 --- /dev/null +++ b/modserver/old/modlists/chernarus.txt @@ -0,0 +1,136 @@ +# ================================================================== +# Inactive +# ================================================================== + +############ Legacy Gun Play +############ https://steamcommunity.com/sharedfiles/filedetails/?id=2560589980 +###########2560589980^legacygunplay + +############### advanced weapon scopes +################ https://steamcommunity.com/sharedfiles/filedetails/?id=2143128974 +###############2143128974^advancedweaponscopes + +############ tactical flava +############# https://steamcommunity.com/sharedfiles/filedetails/?id=2646817942 +###########2646817942^tacticalflava + +############## sGunplay +############## https://steamcommunity.com/sharedfiles/filedetails/?id=2507204412 +#############2507204412^sgunplay + +################## enough stamina +################## https://steamcommunity.com/sharedfiles/filedetails/?id=2337398072 +#################2337398072^enoughstamina + +# ================================================================== +# Generic / All Servers +# ================================================================== + +# Dabs Framework +# https://steamcommunity.com/sharedfiles/filedetails/?id=2545327648 +2545327648^dabsframework + +# CF +# https://steamcommunity.com/sharedfiles/filedetails/?id=1559212036 +1559212036^cf + +# VPP Admin Tools +# https://steamcommunity.com/sharedfiles/filedetails/?id=1828439124 +1828439124^vppadmintools + +# Notes +# https://steamcommunity.com/sharedfiles/filedetails/?id=1999076953 +1999076953^notes + +# Ear Plugs +# https://steamcommunity.com/workshop/filedetails/?id=1819514788 +1819514788^earplugs + +# health regen 2x when blood is full +# https://steamcommunity.com/sharedfiles/filedetails/?id=2434838000&searchtext=health +2434838000^healthregen + +# tent backpacks +# https://steamcommunity.com/sharedfiles/filedetails/?id=2884638645 +2884638645^tentbackpacks + +# durable suppressors (1.5x health) +# https://steamcommunity.com/sharedfiles/filedetails/?id=2880585815 +2880585815^durablesuppressors + +# Zen's Cause of Death +# https://steamcommunity.com/sharedfiles/filedetails/?id=2810260908 +2810260908^causeofdeath + +# Bear Buff (bears aggro from further away, chase players) +# https://steamcommunity.com/sharedfiles/filedetails/?id=2692521272 +2692521272^bearbuff + +# Custom Animations +# https://steamcommunity.com/sharedfiles/filedetails/?id=2545980712 +2545980712^customanimations + +# Worn Repair +# https://steamcommunity.com/sharedfiles/filedetails/?id=2581770969 +2581770969^wornrepair + +# No DepthOfField +# https://steamcommunity.com/sharedfiles/filedetails/?id=1721317955 +1721317955^nodof + +# Zen's Fire Fuel +# https://steamcommunity.com/sharedfiles/filedetails/?id=2866862200 +2866862200^firefuel + +# Zen's Gun Move Sounds +# https://steamcommunity.com/sharedfiles/filedetails/?id=2832627966 +2832627966^gunmovesounds + +# Bad Food +# https://steamcommunity.com/sharedfiles/filedetails/?id=2155069271 +2155069271^badfood + +# ================================================================== +# sUDE +# ================================================================== + +# sFramework +# https://steamcommunity.com/sharedfiles/filedetails/?id=2614334381 +2614334381^sframework + +# sVisual +# https://steamcommunity.com/sharedfiles/filedetails/?id=2469448088 +2469448088^svisual + +# ================================================================== +# Chernarus Specific +# ================================================================== + +# spurgles bagz +# https://steamcommunity.com/sharedfiles/filedetails/?id=2489196158 +2489196158^spurglesbagz + +# fliptransport +# https://steamcommunity.com/sharedfiles/filedetails/?id=1832448183 +1832448183^fliptransport + +# no weapon raise +# https://steamcommunity.com/sharedfiles/filedetails/?id=2098390861 +2098390861^noweaponraise + +# no vehicle damage +# https://steamcommunity.com/sharedfiles/filedetails/?id=1735947752 +1735947752^novehicledamage + +# Doc's Car Fixes +# https://steamcommunity.com/sharedfiles/filedetails/?id=2886222035 +2886222035^docscarfixes + +# Lag's Lighting Overhaul +# https://steamcommunity.com/sharedfiles/filedetails/?id=2873016243 +2873016243^ladslightingoverhaul + +# Uncuepa's Civilian Clothing +# https://steamcommunity.com/sharedfiles/filedetails/?id=1762444175 +1762444175^uncuepascivilianclothing + diff --git a/modserver/old/update.sh b/modserver/old/update.sh new file mode 100644 index 0000000..bb67c52 --- /dev/null +++ b/modserver/old/update.sh @@ -0,0 +1,125 @@ +#!/bin/sh + +DAYZ_GAME_ID=221100 +DAYZ_SERVER_ID=223350 +LOCAL_MODS_DIR="${HOME}/.steam/debian-installation/steamapps/workshop/content/$DAYZ_GAME_ID" +STEAM_USER="yzaddayz" +REMOTE_MAPS="/mnt/dayz/stock/maps" + +alias do_sync='rsync -rvltDhu --delete --partial --progress' + +msg() { + printf '[*] %s\n' "$*" +} + +# ==================================================================================== + +update_server() { + msg "------------------ UPDATING DAYZ SERVER -------------------" + + LOCAL_INSTALL_DIR="${HOME}/.steam/debian-installation/steamapps/common/DayZServer" + REMOTE_INSTALL_DIR="/mnt/dayz/stock/DayZServer" + + steamcmd -tcp +login "$STEAM_USER" +app_update "$DAYZ_GAME_ID" +quit + steamcmd -tcp +login "$STEAM_USER" +app_update "$DAYZ_SERVER_ID" +quit + + do_sync "$LOCAL_INSTALL_DIR"/ "$REMOTE_INSTALL_DIR" + msg "------- DONE UPDATING SERVER ---------------------" +} + +# args: $1=server_name +update_mods() { + MODS_FILE="$HOME/modlists/$1.txt" + REMOTE_MODS_DIR="/mnt/dayz/mods/$1" + mkdir -p "$REMOTE_MODS_DIR" + + tempfile=/tmp/mods-to-download.txt + :> "$tempfile" + + while read -r mod ; do + # skip comments, blank lines + case "$mod" in + \#*|'') + ;; + *) + mod=${mod%%^*} + printf "+workshop_download_item $DAYZ_GAME_ID %s\n" "$mod" >> "$tempfile" + mkdir -p "$LOCAL_MODS_DIR/$mod" + esac + done < "$MODS_FILE" + + msg "----------- DOWNLOAD MODS -------------" + steamcmd -tcp +login "$STEAM_USER" $(cat "$tempfile" | xargs) +quit || exit 1 + + msg "----------- RENAMING MODS -------------" + + rm -rf "$HOME/mods_to_copy" 2>/dev/null ||: + mkdir -p "$HOME/mods_to_copy" + + :> "$HOME/mods_to_copy/mods.txt" + while read -r mod ; do + # skip comments, blank lines + case "$mod" in + \#*|'') + ;; + *) + mod_id=${mod%%^*} + mod_name=${mod##*^} + do_sync "$LOCAL_MODS_DIR/$mod_id"/ "$HOME/mods_to_copy/@${mod_name}" + printf '@%s\n' "$mod_name" >> "$HOME/mods_to_copy/mods.txt" + esac + done < "$MODS_FILE" + + msg "----------- SYNCING MODS -------------" + do_sync "$HOME/mods_to_copy"/ "$REMOTE_MODS_DIR" + + rm "$tempfile" 2>/dev/null ||: + rm -rf "$HOME/mods_to_copy" 2>/dev/null ||: +} + +update_stock_maps() { + msg "----------- UPDATING MAPS -------------" + cherno=dayzOffline.chernarusplus + namalsk=regular.namalsk + takistan=Offline.TakistanPlus + NAMALSK_MOD_ID=2289461232 + TAKISTAN_MOD_ID=2563233742 + + do_sync \ + "${HOME}/.steam/debian-installation/steamapps/common/DayZServer/mpmissions/$cherno"/ \ + "$REMOTE_MAPS/$cherno" + + msg "Updating Namalsk Survival" + steamcmd -tcp +login "$STEAM_USER" +workshop_download_item "$DAYZ_GAME_ID" "$NAMALSK_MOD_ID" +quit || exit 1 + if [ -d "$LOCAL_MODS_DIR/$NAMALSK_MOD_ID/Extras/Regular/$namalsk" ] ; then + do_sync "$LOCAL_MODS_DIR/$NAMALSK_MOD_ID/Extras/Regular/$namalsk"/ "$REMOTE_MAPS/$namalsk" || \ + die "failed to copy Namalsk map files" + fi + + msg "Updating Optimized Namalsk Server PBOs" + #NAMALSK_OPTIMIZED + steamcmd -tcp +login "$STEAM_USER" +workshop_download_item "$DAYZ_GAME_ID" "$NAMALSK_MOD_ID" +quit || exit 1 + + msg "Updating TakistanPlus" + steamcmd -tcp +login "$STEAM_USER" +workshop_download_item "$DAYZ_GAME_ID" "$TAKISTAN_MOD_ID" +quit || exit 1 + if [ -d "$LOCAL_MODS_DIR/$TAKISTAN_MOD_ID/Mission/$takistan" ] ; then + do_sync "$LOCAL_MODS_DIR/$TAKISTAN_MOD_ID/Mission/$takistan"/ "$REMOTE_MAPS/$takistan" || \ + die "failed to copy Takistan map files" + fi + + + msg "NOTE: deer isle doesn't get automatic updates... Skipping" +} + +main () { + update_server + update_stock_maps + + for server in $(ls "$HOME/modlists" | xargs | sed 's/\.txt//g') ; do + rm -rf "$HOME/.steam/debian-installation/steamapps/workshop/downloads" + mkdir -p "$HOME/.steam/debian-installation/steamapps/workshop/downloads" + update_mods "$server" + done +} + +main "$@" diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..f39ad19 --- /dev/null +++ b/start.sh @@ -0,0 +1,405 @@ +#!/usr/bin/env bash +# +# shellcheck disable=2043 +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# General Settings +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +export DAYZ_FILES=/mnt/dayz +export STOCK_SERVER_DATA="$DAYZ_FILES/stock/DayZServer" +export MAIN="/mnt/c/DAYZ" +export SERVERS="$MAIN/servers" +export CACHE="$MAIN/cache" +export MOD_CACHE="$CACHE/mods" + +export FOUR_HOURS="$((60 * 60 * 4))" +export RESTART_INTERVAL="$FOUR_HOURS" + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Helper functions +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +alias do_sync='rsync -rltDh --delete --partial' + +msg() { + >&2 printf '[*] %s ...\n' "$*" +} + +warn() { + >&2 printf '\n\n<<<< WARNING: %s >>>>>\n\n' "$*" +} + +die() { + msg "$*" + exit 1 +} + +debug() { + if [ "$DEBUG" ] ; then + >&2 printf ' DEBUG: %s\n' "$*" + fi +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Checks +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +check() { + mkdir -p "$DAYZ_FILES" + + if ! mount | grep -i "$DAYZ_FILES" >/dev/null ; then + msg "$DAYZ_FILES is not mounted!" + echo "hint: mount -t drvfs //truenas.home.weaver/dayz $DAYZ_FILES" + exit 1 + fi + + if [ ! -d "$MAIN" ] ; then + die "$MAIN does not exist" + fi + + if [ ! -d "$STOCK_SERVER_DATA" ] ; then + die "$STOCK_SERVER_DATA does not exist" + fi +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Environment Setup +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +init() { + mkdir -p "$SERVER_HOME" "$MOD_CACHE/$MAP_FOLDER_NAME" + :>"$SERVER_HOME/.modstring" +} + +setup_environment() { + msg "Copying stock server data" + + # list of all stock folders + for folder in addons battleye bliss docs dta keys ; do + do_sync "$STOCK_SERVER_DATA/$folder"/ "$SERVER_HOME/$folder" || die "Failed to copy stock: $folder" + done + + # list of all stock files + for file in ban.txt dayz.gproj dayzsetting.xml whitelist.txt \ + DayZServer_x64.exe steam_api64.dll steamclient64.dll tier0_s64.dll vstdlib_s64.dll ; do + cp -f "$STOCK_SERVER_DATA/$file" "$SERVER_HOME/$file" || die "Failed to copy stock: $file" + done + + msg "Copying mod files" + do_sync "$DAYZ_FILES/mods/$MAP_FOLDER_NAME"/ "$MOD_CACHE/$MAP_FOLDER_NAME" || die "Failed to copy mod files" + + msg "Copying DZSA executable" + cp -f "$DAYZ_FILES/software/DZSALModServer.exe" "$SERVER_HOME/" +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Load Mods +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +load_mods() { + if [ ! -f "$MOD_CACHE/$MAP_FOLDER_NAME/mods.txt" ] ; then + die "mods.txt list missing" + fi + + mkdir -p "$SERVER_HOME/mods" + + _modstring="" + while read -r mod ; do + case $mod in + '@'*) + msg "- Found mod: $mod" + _modstring="$_modstring;mods/$mod" + do_sync "$MOD_CACHE/$MAP_FOLDER_NAME/$mod"/ "$SERVER_HOME/mods/$mod" + + for addon_folder in addons Addons addon Addon ; do + if [ -d "$SERVER_HOME/mods/$mod/$addon_folder" ] ; then + for addon in "$SERVER_HOME/mods/$mod/$addon_folder"/* ; do + if [ ! -f "$SERVER_HOME/addons/${addon##*/}" ] ; then + cp -f "$addon" "$SERVER_HOME/addons/" + fi + done + fi + done + + for key_folder in keys Keys key Key ; do + if [ -d "$SERVER_HOME/mods/$mod/$key_folder" ] ; then + for key in "$SERVER_HOME/mods/$mod/$key_folder"/* ; do + if [ ! -f "$SERVER_HOME/keys/${key##*/}" ] ; then + cp -f "$key" "$SERVER_HOME/keys/" + fi + done + fi + done + esac + done < "$MOD_CACHE/$MAP_FOLDER_NAME/mods.txt" + + # trim the initial leading ';' + _modstring=${_modstring#;} + printf '%s\n' "$_modstring" > .modstring +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Load Map +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +load_stock_map_data() { + mkdir -p "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME" + do_sync --exclude='*storage_1*' \ + "$DAYZ_FILES/stock/maps/$MAP_FOLDER_NAME"/ \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME" || \ + die "Failed to copy stock map data" +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Types Patching +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +patch_types() { + + if [ ! -f "$DAYZ_FILES/server_configs/types/default_types_to_delete.txt" ] ; then + die "CANNOT REACH FILE: default_types_to_delete.txt" + fi + + # deletes + while read -r line ; do + case "$line" in + '#'*|' '*|'') + ;; + *) + debug "TYPES -- deleting object: $line" + xmlstarlet ed -L -P -d "//types/type[@name=\"$line\"]" \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/db/types.xml" + esac + done < "$DAYZ_FILES/server_configs/types/default_types_to_delete.txt" + + # copy types edit tool + if [ -f "$DAYZ_FILES/scripts/adjust_type.sh" ] ; then + cp -f "$DAYZ_FILES/scripts/adjust_type.sh" "$SERVER_HOME"/ + else + die "Could not find adjust_type.sh" + fi + + if [ -f "$DAYZ_FILES/server_configs/types/$MAP_FOLDER_NAME.sh" ] ; then + cp -f "$DAYZ_FILES/server_configs/types/$MAP_FOLDER_NAME.sh" \ + "$SERVER_HOME"/ + + cd "$SERVER_HOME" || die "could not cd to $SERVER_HOME" + + sh "$SERVER_HOME/$MAP_FOLDER_NAME.sh" \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/db/types.xml" || \ + die "Failed while running maps types edit script" + else + die "Could not find $DAYZ_FILES/server_configs/types/$MAP_FOLDER_NAME.sh" + fi + + # if we're on namalsk, we will have a types_dzn.xml as well + # this file contains the frozen food etc unique namalsk items + case $MAP_FOLDER_NAME in + *namalsk*) + DZN_FILE=namalsk_dzn.sh + msg "Patching $DZN_FILE" + if [ -f "$DAYZ_FILES/server_configs/types/$DZN_FILE" ] ; then + cp -f "$DAYZ_FILES/server_configs/types/$DZN_FILE" \ + "$SERVER_HOME"/ + + cd "$SERVER_HOME" || die "could not cd to $SERVER_HOME" + + sh "$SERVER_HOME/$DZN_FILE" \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/db/types_dzn.xml" || \ + die "Failed while running maps types edit script on types_dzn.xml" + else + die "Could not find $DAYZ_FILES/server_configs/types/$DZN_FILE" + fi + ;; + esac + +} + +load_customtypes() { + if [ -d "$DAYZ_FILES/server_configs/types/custom.$MAP_FOLDER_NAME" ] ; then + CUSTOM_TYPES="$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/customtypes" + CFG_ECORE="$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/cfgeconomycore.xml" + + mkdir -p "$CUSTOM_TYPES" + do_sync "$DAYZ_FILES/server_configs/types/custom.$MAP_FOLDER_NAME"/ \ + "$CUSTOM_TYPES" + + for xml in "$CUSTOM_TYPES"/*.xml ; do + debug " - Found custom type: ${xml##*/}" + if [ -f "$xml" ] ; then + sed -E -i '/<\/economycore>/d' "$CFG_ECORE" + + printf '\n\n\n\n\n' "${xml##*/}" \ + >> "$CFG_ECORE" + + printf '%s\n' '' >> "$CFG_ECORE" + fi + done + fi + + # ============== custom SPAWNABLE types =================== + if [ -d "$DAYZ_FILES/server_configs/types/spawnabletypes.$MAP_FOLDER_NAME" ] ; then + msg "Copying custom spawnable types" + + CUSTOM_SPAWNABLE_TYPES="$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/spawnabletypes" + CFG_SPAWNABLE_TYPES="$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/cfgspawnabletypes.xml" + + mkdir -p "$CUSTOM_SPAWNABLE_TYPES" + do_sync "$DAYZ_FILES/server_configs/types/spawnabletypes.$MAP_FOLDER_NAME"/ \ + "$CUSTOM_SPAWNABLE_TYPES" + + for xml in "$CUSTOM_SPAWNABLE_TYPES"/*.xml ; do + debug " - Found custom spawnabletype: ${xml##*/}" + if [ -f "$xml" ] ; then + sed -E -i '/<\/spawnabletypes>/d' "$CFG_SPAWNABLE_TYPES" + cat "$xml" >> "$CFG_SPAWNABLE_TYPES" + printf '%s\n' '' >> "$CFG_SPAWNABLE_TYPES" + fi + done + fi +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Configs +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +load_configs() { + msg "Loading server configs" + + if [ -d "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME" ] ; then + + for xml in "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME"/*.xml ; do + if [ -f "$xml" ] ; then + debug "Found: $xml -- Copying." + do_sync "$xml" "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/${xml##*/}" || \ + die "Failed to copy: ${xml##*/}" + fi + done + + for json in "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME"/*.json ; do + if [ -f "$json" ] ; then + debug "Found: $json -- Copying." + do_sync "$json" "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/${json##*/}" || \ + die "Failed to copy: ${json##*/}" + fi + done + + if [ -f "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/init.c" ] ; then + debug "Found: init.c -- Copying." + do_sync \ + "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/init.c" \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/init.c" || \ + die "failed to copy init.c" + fi + + if [ -f "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/areaflags.map" ] ; then + debug "Found: areaflags.map -- Copying." + do_sync \ + "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/areaflags.map" \ + "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/areaflags.map" || \ + die "failed to copy areaflags.map" + fi + + fi + + if [ -d "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/db" ] ; then + for xml in "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/db"/*.xml ; do + if [ -f "$xml" ] ; then + debug "Found: $xml -- Copying." + do_sync "$xml" "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/db/${xml##*/}" || \ + die "Failed to copy: ${xml##*/}" + fi + done + fi + + if [ -d "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/env" ] ; then + for xml in "$DAYZ_FILES/server_configs/mpmissions/$MAP_FOLDER_NAME/env"/*.xml ; do + if [ -f "$xml" ] ; then + debug "Found: $xml -- Copying." + do_sync "$xml" "$SERVER_HOME/mpmissions/$MAP_FOLDER_NAME/env/${xml##*/}" || \ + die "Failed to copy: ${xml##*/}" + fi + done + fi + + msg "Copying generic Profilesfolder configs" + if [ -d "$DAYZ_FILES/server_configs/Profilesfolder/sUDE/config" ] ; then + mkdir -p "$SERVER_HOME/Profilesfolder/sUDE/config" + cp -f "$DAYZ_FILES/server_configs/Profilesfolder/sUDE/config"/* "$SERVER_HOME/Profilesfolder/sUDE/config"/ + else + die "missing: $DAYZ_FILES/server_configs/Profilesfolder/sUDE/config" + fi +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Main +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +main() { + init + cd "$SERVER_HOME" || die "Could not cd to '$SERVER_HOME'" + + check || die "Failed check" + + msg "Setting up environment" + setup_environment || die "Could not set up environment." + + msg "Loading mods" + load_mods || die "Could not load mods" + mod_string=$(cat .modstring) + + msg "Loading stock map data" + load_stock_map_data || die "Could not load map" + + msg "Patching types.xml" + patch_types || die "Failed to patch types" + + msg "Copying server configs" + load_configs || die "Failed to load configs" + + msg "Creating custom types list" + load_customtypes || die "Failed to load custom types" + + echo '====================================' + printf '%s - Server started.\n' "$(date)" + echo '====================================' + +# creating temp.bat here to avoid the arg max char limit of windows cmd.exe +cat > temp.bat </dev/null ||: + + msg "Sleeping 10 seconds to settle" + sleep 10 + msg "SERVER IS RESTARTING" +} + +ORIGINAL_DIR="$PWD" + +while msg 'Starting loop' ; do + cd "$ORIGINAL_DIR" || die "Can no longer cd to $ORIGINAL_DIR" + + if [ -e ./SERVER.ENV ] ; then + . ./SERVER.ENV + else + die "Could not source ./SERVER.ENV" + fi + + if [ -f ./serverDZ.cfg ] ; then + cp -f ./serverDZ.cfg "$SERVER_HOME"/ + else + die "Could not find ./serverDZ.cfg" + fi + + main "$@" +done