From 52fc1afcc3a667c0975c43bcfea13fb83a3a3228 Mon Sep 17 00:00:00 2001 From: Jared Ballou Date: Tue, 9 Feb 2016 18:58:06 -0500 Subject: [PATCH] Committing new gamedata and mod changes --- functions/core_functions.sh | 4 ++++ functions/game_settings.sh | 8 ++++++++ functions/install_lgsm.sh | 2 +- functions/install_mod.sh | 39 +++++++++++++++++++++++++++++++++++++ functions/menu.sh | 4 ++-- gamedata/_default | 9 ++++++--- gamedata/_halflife_shared | 2 +- gamedata/_seriousengine35 | 2 +- gamedata/_spark | 2 +- gamedata/dabserver | 3 +-- gamedata/dstserver | 2 +- gamedata/fofserver | 2 +- gamedata/insserver | 2 +- gamedata/nmrihserver | 2 +- 14 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 functions/install_mod.sh diff --git a/functions/core_functions.sh b/functions/core_functions.sh index 64d571c64..ce63fab87 100644 --- a/functions/core_functions.sh +++ b/functions/core_functions.sh @@ -337,6 +337,10 @@ log_dirs.sh(){ fn_runfunction "${FUNCNAME}" } +install_mod.sh(){ +fn_runfunction "${FUNCNAME}" +} + install_retry.sh(){ fn_runfunction "${FUNCNAME}" diff --git a/functions/game_settings.sh b/functions/game_settings.sh index 150555b78..e69a35cc4 100644 --- a/functions/game_settings.sh +++ b/functions/game_settings.sh @@ -198,3 +198,11 @@ if [ ! -f $cfg_file_common ]; then fn_create_config common; else source $cfg_fil # Load instance specific settings if [ ! -f $cfg_file_instance ]; then fn_create_config instance; else source $cfg_file_instance; fi + +# Import mod +if [ "${game_mod}" != "" ]; then + modfile="mods/${selfname}/${game_mod}" + echo $modfile + fn_set_game_setting settings "game_mod" "${game_mod}" + fn_import_game_settings "${modfile}" +fi diff --git a/functions/install_lgsm.sh b/functions/install_lgsm.sh index 36669d4de..40ac5f604 100644 --- a/functions/install_lgsm.sh +++ b/functions/install_lgsm.sh @@ -20,7 +20,7 @@ fn_getgithubfile $gamelist # Display installer menu fn_menu result "Linux Game Server Manager" "Select game to install" "${lgsmdir}/${gamelist}" -echo $result +#echo $result # If we have a selection, do the install if [ -n "${result}" ]; then if [ "${BASH_SOURCE[0]}" == "" ]; then diff --git a/functions/install_mod.sh b/functions/install_mod.sh new file mode 100644 index 000000000..ee32fceef --- /dev/null +++ b/functions/install_mod.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# LGSM install_mod function +# Author: Jared Ballou +# Website: http://gameservermanagers.com + +# Description: Display menu of available mods, and add them to game settings + +# Perform installation +fn_runfunction menu.sh + +# Listing of available games +modlist="gamedata/__mod_list" + +# Installation path +installpath=$(cd ~ && pwd) + +# Get game list +fn_getgithubfile "${modlist}" + +gamemods="$(grep "^${selfname}\/" "${lgsmdir}/${modlist}" | cut -d'/' -f2-)" +if [ "${gamemods}" == "" ]; then + echo "Sorry, there are no mods available for your current game." + exit +fi + +# Display installer menu +fn_menu result "Linux Game Server Manager" "Select mod to install" "${gamemods}" +#echo $result +# If we have a selection, do the install +if [ -n "${result}" ]; then + game_mod="${result}" + fn_set_game_setting settings "game_mod" "${result}" + fn_update_config "game_mod" "${result}" "${cfg_file_instance}" +# modlink="${lgsmserverdir}/mod" +# modtarget="${gamedatadir}/mods/${selfname}/${result}" +# if [ "$(readlink -f "${modlink}")" != "${modtarget}" ]; then +# ln -nsvf "${modtarget}" "${modlink}" +# fi +fi diff --git a/functions/menu.sh b/functions/menu.sh index 0e7dce75a..a46ce8dcd 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -61,8 +61,8 @@ fn_menu() { caption=$3 options=$4 # If this is a list of options as a string, dump it to a file so we can process it - if [ ! -e $options ]; then - echo -ne "{$options}\n" > "${cachedir}/menu.options" + if [ ! -e "${options}" ]; then + echo -ne "${options}\n" > "${cachedir}/menu.options" options="${cachedir}/menu.options" fi diff --git a/gamedata/_default b/gamedata/_default index cea0c3fb4..7fe5b5ff8 100644 --- a/gamedata/_default +++ b/gamedata/_default @@ -2,12 +2,10 @@ # _default # Base defaults for all games -# Set the default settings for the script -fn_set_game_setting settings "dependency_path" "${filesdir}" - # Default settings. This group includes a lot of blanks just so that the comments are set (and the engine/game files will show blank values to remind people to set them). fn_set_game_setting settings "backupdir" "\${lgsmdir}/backups" "Backup Directory" fn_set_game_setting settings "map" "--EMPTY--" "Default map to load" +fn_set_game_setting settings "game_mod" "--EMPTY--" "Mod to load from gamedata/mods" fn_set_game_setting settings "email" "email@example.com" "Email address for notification" fn_set_game_setting settings "emaillog" "\${scriptlogdir}/\${servicename}-email.log" "Email Log" fn_set_game_setting settings "emailnotification" "off" "Email notification (on|off)" @@ -43,6 +41,9 @@ fn_set_game_setting settings "servercfg" "\${servicename}\${servercfg_suffix}" " fn_set_game_setting settings "servercfgdefault" "\${servercfgdir}/lgsm-default\${servercfg_suffix}" "Default server configuration file" fn_set_game_setting settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" "Full path to server config" +# Set the default settings for the script +fn_set_game_setting settings "dependency_path" "\${filesdir}" + fn_set_game_setting settings "server_parms" "--EMPTY--" "Additional Server command-line arguments. Put the parameters that start with \"-\" first, then \"+\" parameters after" # Script actions @@ -50,6 +51,7 @@ fn_set_game_setting scriptactions "st" "start|command_start.sh|Start the server. fn_set_game_setting scriptactions "sp" "stop|command_stop.sh|Stop the server." fn_set_game_setting scriptactions "r" "restart|fn_restart|Restart the server." fn_set_game_setting scriptactions "dd" "depsdetect|command_dev_detect_deps.sh|Detect Dependencies" +fn_set_game_setting scriptactions "gd" "game-dependencies|fn_fix_game_dependencies|Make sure that the correct libraries for this game are installed" fn_set_game_setting scriptactions "u" "update|update_check.sh|Checks and applies updates from SteamCMD." fn_set_game_setting scriptactions "uf" "update-functions|update_functions.sh|Removes all functions so latest can be downloaded." fn_set_game_setting scriptactions "m" "monitor|command_monitor.sh|Checks that the server is running." @@ -60,6 +62,7 @@ fn_set_game_setting scriptactions "dev" "dev-debug|command_dev_debug.sh|Toggle D fn_set_game_setting scriptactions "i" "install|command_install.sh|Install the server." fn_set_game_setting scriptactions "ai" "auto-install|fn_autoinstall|Install the server, without prompts." fn_set_game_setting scriptactions "b" "backup|command_backup.sh|Create archive of the server." +fn_set_game_setting scriptactions "im" "install-mod|install_mod.sh|Install mods" # Default fn_parms just loads the parms file. Still need to figure out how to handle "simple" parms. fn_parms(){ diff --git a/gamedata/_halflife_shared b/gamedata/_halflife_shared index 020aa69fc..59be83da6 100644 --- a/gamedata/_halflife_shared +++ b/gamedata/_halflife_shared @@ -8,7 +8,7 @@ fn_import_game_settings _parms_plusminus fn_import_game_settings _tickrate # Dependencies -fn_set_game_setting settings "dependency_path" "${filesdir}/bin" +fn_set_game_setting settings "dependency_path" "\${filesdir}/bin" # Game Parameters diff --git a/gamedata/_seriousengine35 b/gamedata/_seriousengine35 index 6ffc5f96c..d00ee234b 100644 --- a/gamedata/_seriousengine35 +++ b/gamedata/_seriousengine35 @@ -6,7 +6,7 @@ fn_import_game_settings _steam # Dependencies -fn_set_game_setting settings "dependency_path" "${filesdir}/Bin" +fn_set_game_setting settings "dependency_path" "\${filesdir}/Bin" fn_set_game_setting dependencies "libstdc++.so.6" "4f9c911de2276f988afaf47659a8367f" # Game settings diff --git a/gamedata/_spark b/gamedata/_spark index 9043c91ff..8a74db026 100644 --- a/gamedata/_spark +++ b/gamedata/_spark @@ -11,7 +11,7 @@ parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser } # Dependencies -fn_set_game_setting settings "dependency_path" "${filesdir}" +fn_set_game_setting settings "dependency_path" "\${filesdir}" fn_set_game_setting dependencies "libm.so.6" "b6fef88fd045bfcd05fd4036f323855c" fn_set_game_setting dependencies "libstdc++.so.6" "4f9c911de2276f988afaf47659a8367f" fn_set_game_setting dependencies "libc.so.6" "7d751c7d8c061730fc5cb7317322d370 diff --git a/gamedata/dabserver b/gamedata/dabserver index d65ba85d4..e94a21f2c 100644 --- a/gamedata/dabserver +++ b/gamedata/dabserver @@ -6,8 +6,7 @@ fn_import_game_settings _source fn_parms(){ parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${tv_port} +map ${map} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } - -fn_set_game_setting settings "dependency_path" "${filesdir}" +fn_set_game_setting settings "dependency_path" "\${filesdir}" fn_set_game_setting dependencies "libm.so.6" "b6fef88fd045bfcd05fd4036f323855c" fn_set_game_setting settings "appid" "317800" diff --git a/gamedata/dstserver b/gamedata/dstserver index 6332bbb34..4a5014af5 100644 --- a/gamedata/dstserver +++ b/gamedata/dstserver @@ -8,7 +8,7 @@ parms="" } # Dependencies -fn_set_game_setting settings "dependency_path" "${filesdir}/bin/lib32" +fn_set_game_setting settings "dependency_path" "\${filesdir}/bin/lib32" fn_set_game_setting dependencies "libpthread.so.0" "50a2a33d3cdd82f15c3de6539db7bf60" fn_set_game_setting dependencies "librt.so.1" "eabf0fc1f81292270343bd0796fc64ca" fn_set_game_setting dependencies "libc.so.6" "c856f3fcac0a944a36e723b06bdbeb7e" diff --git a/gamedata/fofserver b/gamedata/fofserver index 5b1bd0e72..e06a2f99e 100644 --- a/gamedata/fofserver +++ b/gamedata/fofserver @@ -6,7 +6,7 @@ fn_import_game_settings _source fn_parms(){ parms="-game fof -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${tv_port} +map ${map} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } -fn_set_game_setting settings "dependency_path" "${filesdir}" +fn_set_game_setting settings "dependency_path" "\${filesdir}" fn_set_game_setting dependencies "libm.so.6" "b6fef88fd045bfcd05fd4036f323855c" fn_set_game_setting settings "appid" "295230" diff --git a/gamedata/insserver b/gamedata/insserver index bc840860b..3b8e2760a 100644 --- a/gamedata/insserver +++ b/gamedata/insserver @@ -23,7 +23,7 @@ fn_set_game_setting settings "gamename" "Insurgency" fn_set_game_parm parms_plus "sv_playlist" "custom" "Server Playlist" # Mapcycle -fn_set_game_parm params_plus "mapcyclefile" "mapcycle_cooperative.txt" +fn_set_game_parm parms_plus "mapcyclefile" "mapcycle_cooperative.txt" # Workshop fn_set_game_parm parms_plus "sv_workshop_enabled" "--EMPTY--" "Comma-delimited list of workshop items to subscribe to" diff --git a/gamedata/nmrihserver b/gamedata/nmrihserver index 2b0f90ad3..2796aaf95 100644 --- a/gamedata/nmrihserver +++ b/gamedata/nmrihserver @@ -8,7 +8,7 @@ parms="-game nmrih -insecure -strictportbind -ip ${ip} -port ${port} +clientport } # Dependencies -fn_set_game_setting settings "dependency_path" "${filesdir}" +fn_set_game_setting settings "dependency_path" "\${filesdir}" fn_set_game_setting dependencies "libm.so.6" "b6fef88fd045bfcd05fd4036f323855c" fn_set_game_setting dependencies "libstdc++.so.6" "4f9c911de2276f988afaf47659a8367f"