From 5b09a144fcdf791060b6f896ab898ae488611b5c Mon Sep 17 00:00:00 2001 From: Jared Ballou Date: Wed, 27 Jan 2016 21:29:59 -0500 Subject: [PATCH] Adding beta and workshop support for Source engine games --- functions/command_validate.sh | 4 ++-- functions/fix.sh | 33 ++++++++------------------------ functions/game_settings.sh | 26 +++++++++++++++++++++++++ functions/install_serverfiles.sh | 10 +++++----- functions/update_dl.sh | 4 ++-- gamedata/_halflife_shared | 2 +- gamedata/_parms_plusminus | 10 ++++++++-- gamedata/insserver | 12 ++++++++++-- 8 files changed, 62 insertions(+), 39 deletions(-) diff --git a/functions/command_validate.sh b/functions/command_validate.sh index b6dc36819..811f3d119 100644 --- a/functions/command_validate.sh +++ b/functions/command_validate.sh @@ -29,9 +29,9 @@ if [ $(command -v unbuffer) ]; then fi if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}" + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid} -beta ${beta}" +app_update "${appid} -beta ${beta}" validate +quit|tee -a "${scriptlog}" else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}" + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid} -beta ${beta}" validate +quit|tee -a "${scriptlog}" fi fix.sh diff --git a/functions/fix.sh b/functions/fix.sh index 931f4acbe..1f22b5a06 100644 --- a/functions/fix.sh +++ b/functions/fix.sh @@ -2,17 +2,22 @@ # LGSM fix.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="020116" +lgsm_version="260116" # Description: Overall function for managing fixes. # Runs functions that will fix an issue. # Fixes that are run on start if [ "${function_selfname}" != "command_install.sh" ]; then + echo "" + echo "Applying ${gamename} Server Fixes" + echo "=================================" + sleep 1 + fn_fix_game_dependencies + fix_glibc.sh if [ ! -z "${appid}" ]; then fix_steamcmd.sh fi - if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then startfix=1 fix_csgo.sh @@ -22,35 +27,13 @@ if [ "${function_selfname}" != "command_install.sh" ]; then fix_ins.sh elif [ "${gamename}" == "ARMA 3" ]; then fix_arma3.sh - fi -fi - -# Fixes that are run on install only. -if [ "${function_selfname}" == "command_install.sh" ]; then - fix_glibc.sh - if [ "${gamename}" == "Killing Floor" ]; then - echo "" - echo "Applying ${gamename} Server Fixes" - echo "=================================" - sleep 1 + elif [ "${gamename}" == "Killing Floor" ]; then fix_kf.sh elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then - echo "" - echo "Applying ${gamename} Server Fixes" - echo "=================================" - sleep 1 fix_ro.sh elif [ "${gamename}" == "Unreal Tournament 2004" ]; then - echo "" - echo "Applying ${gamename} Server Fixes" - echo "=================================" - sleep 1 fix_ut2k4.sh elif [ "${gamename}" == "Unreal Tournament 99" ]; then - echo "" - echo "Applying ${gamename} Server Fixes" - echo "=================================" - sleep 1 fix_ut99.sh fi fi diff --git a/functions/game_settings.sh b/functions/game_settings.sh index 41923f2a0..f75276e1f 100644 --- a/functions/game_settings.sh +++ b/functions/game_settings.sh @@ -124,6 +124,32 @@ fn_get_game_params(){ param_default=$3 } +# Fix dependency files for game +fn_fix_game_dependencies() { + depfile="${settingsdir}/dependencies" + # If no dependency list, skip out + if [ ! -e "${depfile}" ]; then + return + fi + + # If the directory doesn't yet exist, exit the function. + # This is so that we wait until the game is installed before putting these files in place + if [ ! -e "${dependency_path}" ]; then + return + fi + + while read -r line; do + filename=$(echo $line | cut -d'=' -f1) + md5sum=$(echo $line | cut -d'"' -f2) + remote_path="dependencies/${filename}.${md5sum}" + local_path="${dependency_path}/${filename}" + local_md5="$(md5sum "${local_path}" | awk '{print $1}')" + echo "Checking ${filename} for ${md5sum}" + if [ "${local_md5}" != "${md5sum}" ]; then + fn_getgithubfile "${local_path}" 0 "${remote_path}" 1 + fi + done < $depfile +} # Flush old setings buffer fn_flush_game_settings diff --git a/functions/install_serverfiles.sh b/functions/install_serverfiles.sh index 24677da9c..06d0a2340 100644 --- a/functions/install_serverfiles.sh +++ b/functions/install_serverfiles.sh @@ -37,15 +37,15 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .finstall_serverfiles.sh.tmp) if [ "${counter}" -le "4" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid} -beta ${beta}" +quit |tee .finstall_serverfiles.sh.tmp else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid} -beta ${beta}" +quit |tee .finstall_serverfiles.sh.tmp fi elif [ "${counter}" -ge "5" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid} -beta ${beta}" -validate +quit |tee .finstall_serverfiles.sh.tmp else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid} -beta ${beta}" -validate +quit |tee .finstall_serverfiles.sh.tmp fi fi elif [ "${counter}" -ge "11" ]; then @@ -61,7 +61,7 @@ if [ "${engine}" == "goldsource" ]; then counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid} -beta ${beta}" -validate +quit |tee .finstall_serverfiles.sh.tmp done fi rm -f .finstall_serverfiles.sh.tmp diff --git a/functions/update_dl.sh b/functions/update_dl.sh index 954680ab3..721aef956 100644 --- a/functions/update_dl.sh +++ b/functions/update_dl.sh @@ -19,9 +19,9 @@ if [ $(command -v unbuffer) ]; then fi if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit|tee -a "${scriptlog}" + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid} -beta ${beta}" +quit|tee -a "${scriptlog}" else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}" + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid} -beta ${beta}" +quit|tee -a "${scriptlog}" fi fix.sh diff --git a/gamedata/_halflife_shared b/gamedata/_halflife_shared index 3046e9143..57f6430b8 100644 --- a/gamedata/_halflife_shared +++ b/gamedata/_halflife_shared @@ -13,7 +13,7 @@ fn_set_game_params settings "dependency_path" "${filesdir}/bin" # The parms that start with - go first fn_set_game_params parms_minus "game" "\${game}" -fn_set_game_params parms_minus "strictportbind" "--EMPTY--" +fn_set_game_params parms_minus "strictportbind" " " fn_set_game_params parms_minus "ip" "\${ip}" fn_set_game_params parms_minus "port" "\${port}" fn_set_game_params parms_minus "maxplayers" "\${maxplayers}" diff --git a/gamedata/_parms_plusminus b/gamedata/_parms_plusminus index 7569e86f4..8e1766887 100644 --- a/gamedata/_parms_plusminus +++ b/gamedata/_parms_plusminus @@ -2,9 +2,15 @@ # _parms_plusminus # Parameter parsing with "+" and "-" sorting +# Process parameter list +fn_process_parmlist(){ + prefix=$1 + file=$2 + echo $(grep -v '=""$' "${file}" | sed -e "s/^\([^#=]\+\)=\"/${prefix}\1 /g" -e 's/\"$//g') +} # This is the way we create a script that collates and parses the parameters fn_parms(){ - parms_minus="$(echo $(sed -e 's/^\([^#=]\+\)=\"/\-\1 /g' -e 's/\"$//g' ${settingsdir}/parms_minus))" - parms_plus="$(echo $(sed -e 's/^\([^#=]\+\)=\"/\+\1 /g' -e 's/\"$//g' ${settingsdir}/parms_plus))" + parms_minus="$(fn_process_parmlist "\-" ${settingsdir}/parms_minus)" + parms_plus="$(fn_process_parmlist "\+" ${settingsdir}/parms_plus)" parms="$(eval "echo \"${parms_minus} ${server_parms} ${parms_plus}\"")" } diff --git a/gamedata/insserver b/gamedata/insserver index c343a19c1..35d23e32a 100644 --- a/gamedata/insserver +++ b/gamedata/insserver @@ -18,9 +18,17 @@ fn_set_game_params settings "game" "insurgency" fn_set_game_params settings "gamename" "Insurgency" # Add playlist parameter -fn_set_game_params parms_plus "sv_playlist" "\${playlist}" -fn_set_game_params settings "playlist" "custom" "Server Playlist" +fn_set_game_params parms_plus "sv_playlist" "\${sv_playlist}" +fn_set_game_params settings "sv_playlist" "custom" "Server Playlist" # Mapcycle fn_set_game_params params_plus "mapcyclefile" "\${mapcyclefile}" fn_set_game_params settings "mapcyclefile" "mapcycle_cooperative.txt" "Mapcycle File" + +# Workshop +fn_set_game_params parms_plus "sv_workshop_enabled" "--EMPTY--" "Comma-delimited list of workshop items to subscribe to" + +# Beta +fn_set_game_params parms_minus "beta" "\${beta}" +fn_set_game_params settings "beta" "--EMPTY--" "Beta branch to use. Leave empty for stable branch" +