diff --git a/files/dz-common b/files/dz-common index 541b3ff..a94157d 100755 --- a/files/dz-common +++ b/files/dz-common @@ -104,17 +104,6 @@ check_install(){ fi } -# Assemble the workshop variables -get_mods(){ - mapfile -t workshopID < "${WORKSHOP_CFG}" - workshoplist="" - for i in "${workshopID[@]}" - do - ID=$(echo ${i} | cut -d: -f1) - workshoplist+=" +workshop_download_item "${release_client_appid}" "${ID} - done -} - get_mod_id_by_index(){ # If we were passed a valid mod id, just return it if [[ -d "${workshopdir}/${1}" ]] diff --git a/files/serverDZ.cfg b/files/serverDZ.cfg index 4edfabb..d692701 100644 --- a/files/serverDZ.cfg +++ b/files/serverDZ.cfg @@ -7,7 +7,7 @@ maxPlayers = 60; // Maximum amount of players verifySignatures = 2; // Verifies .pbos against .bisign files. (only 2 is supported) -forceSameBuild = 1; // When enabled, the server will allow the connection only to clients with same the .exe revision as the server (value 0-1) +forceSameBuild = 0; // When enabled, the server will allow the connection only to clients with same the .exe revision as the server (value 0-1) disableVoN = 0; // Enable/disable voice over network (value 0-1) vonCodecQuality = 30; // Voice over network codec quality, the higher the better (values 0-30) diff --git a/server/bin/dz b/server/bin/dz index 7aa6c25..7fe1714 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -13,18 +13,20 @@ SERVER_CFG_DST="${SERVER_PROFILE}/${SERVER_CFG_FILE}" SERVER_CFG_SRC="${CFG_SRC_FILES}/${SERVER_CFG_FILE}" # Command line parameters except mod, as that is handled separately. -parameters="-config=${SERVER_CFG_FILE} -port=${port} -freezecheck -BEpath=${SERVER_FILES}/battleye -profiles=${SERVER_PROFILE} -nologs" +parameters="-config=${SERVER_CFG_DST} -port=${port} -freezecheck -BEpath=${SERVER_PROFILE}/battleye -profiles=${SERVER_PROFILE} -nologs" # Used to check if dayZ is installed SERVER_INSTALL_FILE="${SERVER_FILES}/DayZServer" -# Workshop. This file will store metadata about what mods are installed. +# Workshop. This file will store metadata about what mods are in use in this server instance WORKSHOP_CFG="${HOME}/workshop.cfg" if [ ! -f "${WORKSHOP_CFG}" ] then touch "${WORKSHOP_CFG}" fi +INSTALLED_MODS="${SERVER_FILES}/workshop.cfg" + # An array to store Workshop items. Each element contains the mod's ID, name, and state (active or not). declare -a workshopID workshopfolder="${SERVER_FILES}/steamapps/workshop/content/${release_client_appid}" @@ -91,60 +93,6 @@ report() { echo -e "========================================== End log ======================================${default}" } -# Ensures all is installed and ready before allowing operations that depends on things being ready. -# Installs the initial server config file from its template. -# Handles the importing of changes to that template. -# Installs the initial Battleye RCON config. -loadconfig(){ -# check_install - # Handle the initial server configuration file - if [ ! -f ${SERVER_CFG_DST} ] - then - echo "Creating initial server configuration file" - cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" - fi - # battleye config and rconpassword setup - # The server creates a new file from this file, which it then uses. - # Let's make sure to delete it first - BE_SERVER_FILE="${SERVER_FILES}/battleye/beserver_x64.cfg" - ALT_BE_SERVER_FILE=$(find ${SERVER_FILES}/battleye -name "beserver_x64_active*") - if [ ! -f "${BE_SERVER_FILE}" ] && [ ! -f "${ALT_BE_SERVER_FILE}" ] - then - passwd=$(openssl rand -base64 8 | tr -dc 'A-Za-z0-9') - if [ "${passwd}" == "" ] - then - passwd=$(< /dev/urandom tr -dc 'A-Za-z0-9' | head -c10) - fi - if [ "${passwd}" == "" ] - then - printf "[ ${red}FAIL${default} ] Could not generate a passwort for RCON!\nOpen the Battleye config with 'dayzserver rcon'." - exit 1 - else - cat > "${BE_SERVER_FILE}" < ~/py3rcon.config.json -} - # Start the server in the foreground start(){ # Do the report on exit. Set here so that it only happens once we're starting the server, and not for other actions. @@ -210,6 +158,16 @@ config(){ } # Assemble the workshop variables +get_installed_mods(){ + mapfile -t installedModsID < "${INSTALLED_MODS}" + workshoplist="" + for i in "${installedModsID[@]}" + do + ID=$(echo ${i} | cut -d: -f1) + workshoplist+=" +workshop_download_item "${release_client_appid}" "${ID} + done +} + get_mods(){ mapfile -t workshopID < "${WORKSHOP_CFG}" workshoplist="" @@ -284,10 +242,10 @@ activate(){ list } -# List mods +# List available mods list(){ - # The state may have changed since we started - get_mods + get_installed_mods + if [[ "${workshopID[@]}" = "" ]] then return @@ -376,8 +334,8 @@ rcon(){ # Display the status of everything status(){ + loadconfig INSTALLED="${NO}" - LOGGED_IN="${NO}" RUNNING="${NO}" # DayZ Server files installation @@ -385,17 +343,6 @@ status(){ then INSTALLED="${YES}" fi - # Logged into Steam - if [ -f "${STEAM_LOGIN}" ] - then - LOGGED_IN="${YES}" - if grep -q anonymous "${STEAM_LOGIN}" - then - ANONYMOUS="${yellow}(as anonymous)${default}" - else - ANONYMOUS="${green}(not anonymous)${default}" - fi - fi # Running or not if pidof DayZServer > /dev/null then @@ -410,7 +357,9 @@ status(){ # Current parameters RUNNING="${RUNNING}\nRunning Parameters: $(cat /tmp/parameters)\nRunning mod parameter: $(cat /tmp/mod_command_line)" fi + mod_cmd + MAP="none" # Map name if [[ -f ${SERVER_CFG_DST} ]] diff --git a/web/bin/dz b/web/bin/dz index c3e9f1f..4c12c58 100755 --- a/web/bin/dz +++ b/web/bin/dz @@ -13,6 +13,8 @@ fi declare -a workshopID workshopfolder="${SERVER_FILES}/steamapps/workshop/content/${release_client_appid}" +workshoplist="" + # Functions # Usage @@ -36,6 +38,60 @@ ${default}" exit 1 } +# Ensures all is installed and ready before allowing operations that depends on things being ready. +# Installs the initial server config file from its template. +# Handles the importing of changes to that template. +# Installs the initial Battleye RCON config. +loadconfig(){ +# check_install + # Handle the initial server configuration file + if [ ! -f ${SERVER_CFG_DST} ] + then + echo "Creating initial server configuration file" + cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" + fi + # battleye config and rconpassword setup + # The server creates a new file from this file, which it then uses. + # Let's make sure to delete it first + BE_SERVER_FILE="${SERVER_FILES}/battleye/beserver_x64.cfg" + ALT_BE_SERVER_FILE=$(find ${SERVER_FILES}/battleye -name "beserver_x64_active*") + if [ ! -f "${BE_SERVER_FILE}" ] && [ ! -f "${ALT_BE_SERVER_FILE}" ] + then + passwd=$(openssl rand -base64 8 | tr -dc 'A-Za-z0-9') + if [ "${passwd}" == "" ] + then + passwd=$(< /dev/urandom tr -dc 'A-Za-z0-9' | head -c10) + fi + if [ "${passwd}" == "" ] + then + printf "[ ${red}FAIL${default} ] Could not generate a passwort for RCON!\nOpen the Battleye config with 'dayzserver rcon'." + exit 1 + else + cat > "${BE_SERVER_FILE}" < ~/py3rcon.config.json +} + # Handle the Steam login information. login(){ loadconfig @@ -149,29 +205,34 @@ modupdate(){ # List mods list(){ - # The state may have changed since we started - get_mods + mapfile -t workshopID < "${WORKSHOP_CFG}" + workshoplist="" + for i in "${workshopID[@]}" + do + ID=$(echo ${i} | cut -d: -f1) + workshoplist+=" +workshop_download_item "${release_client_appid}" "${ID} + done if [[ "${workshopID[@]}" = "" ]] then return fi X=1 spaces=" " - echo -e "\n ID Name Active URL Size" + echo -e "\n ID Name URL Size" echo "------------------------------------------------------------------------------------------------------------------------" for i in "${workshopID[@]}" do ID=$(echo ${i} | cut -d: -f1) NAME=$(echo ${i} | cut -d: -f2) - ACTIVE=$(echo ${i} | cut -d: -f3) +# ACTIVE=$(echo ${i} | cut -d: -f3) SIZE=$(du -sh ${SERVER_FILES}/steamapps/workshop/content/221100/${ID} | awk '{print $1}') - if [[ ${ACTIVE} = "1" ]] - then +# if [[ ${ACTIVE} = "1" ]] +# then C="${green}" - else - C="${red}" - fi - printf "${C}%.3d %s %.23s %s %s https://steamcommunity.com/sharedfiles/filedetails/?id=%s %s${default}\n" ${X} ${ID} "${NAME}" "${spaces:${#NAME}+1}" ${ACTIVE} ${ID} ${SIZE} +# else +# C="${red}" +# fi + printf "${C}%.3d %s %.23s %s https://steamcommunity.com/sharedfiles/filedetails/?id=%s %s${default}\n" ${X} ${ID} "${NAME}" "${spaces:${#NAME}+1}" ${ID} ${SIZE} X=$((X+1)) done } @@ -224,8 +285,6 @@ shift || { usage } -get_mods - case "${C}" in add) add "${@}"