Browse Source

Fixed LGSM install config

* LGSM will alter all hostnames to LinuxGSM and generate a random admin
password
* Removed user input for hostname and password as added more complexity
in to the code that can lead to mistakes by devs

Users can will simply change settings in there config as required.
pull/1128/head
Daniel Gibbs 9 years ago
parent
commit
831e4a31aa
  1. 102
      lgsm/functions/install_config.sh

102
lgsm/functions/install_config.sh

@ -19,26 +19,20 @@ fn_fetch_default_config(){
done
}
# allow user to input server name and password
fn_user_input_config(){
if [ -z "${autoinstall}" ]; then
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
read -p "Enter server name: " servername
read -p "Enter rcon password: " rconpass
else
# Changes some variables within the default configs
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
servername="LinuxGSM"
rconpass="rcon$RANDOM"
fi
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
sed -i "s/\"<hostname>\"/\"${servername}\"/g" "${servercfgfullpath}"
sleep 1
sed -i "s/\"SERVERNAME\"/\"${servername}\"/g" "${servercfgfullpath}"
echo "changing rconpassword."
fn_script_log_info "changing RCON password."
sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgfullpath}"
fn_script_log_info "changing RCON/ADMIN password."
sed -i "s/\"ADMINPASSWORD\"/\"${rconpass}\"/g" "${servercfgfullpath}"
sleep 1
}
@ -72,191 +66,199 @@ if [ "${gamename}" == "7 Days To Die" ]; then
array_configs+=( serverconfig.xml )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
gamedirname="ARKSurvivalEvolved"
array_configs+=( GameUserSettings.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARMA 3" ]; then
gamedirname="Arma3"
array_configs+=( server.cfg network.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Battlefield: 1942" ]; then
gamedirname="Battlefield1942"
array_configs+=( serversettings.con )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Blade Symphony" ]; then
gamedirname="BladeSymphony"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "BrainBread 2" ]; then
gamedirname="BrainBread2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then
gamedirname="BlackMesa"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Codename CURE" ]; then
gamedirname="CodenameCURE"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike 1.6" ]; then
gamedirname="CounterStrike"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Condition Zero" ]; then
gamedirname="CounterStrikeConditionZero"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Global Offensive" ]; then
gamedirname="CounterStrikeGlobalOffensive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Counter-Strike: Source" ]; then
gamedirname="CounterStrikeSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Day of Defeat" ]; then
gamedirname="DayOfDefeat"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Day of Defeat: Source" ]; then
gamedirname="DayOfDefeatSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Day of Infamy" ]; then
gamedirname="DayOfInfamy"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Deathmatch Classic" ]; then
gamedirname="DeathmatchClassic"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Don't Starve Together" ]; then
gamedirname="DontStarveTogether"
array_configs+=( Settings.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
gamedirname="DoubleActionBoogaloo"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Fistful of Frags" ]; then
gamedirname="FistfulofFrags"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Garry's Mod" ]; then
gamedirname="GarrysMod"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "GoldenEye: Source" ]; then
gamedirname="GoldenEyeSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Half Life: Deathmatch" ]; then
gamedirname="HalfLifeDeathmatch"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Half-Life Deathmatch: Source" ]; then
gamedirname="HalfLifeDeathmatchSource"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Half-Life: Opposing Force" ]; then
gamedirname="OpposingForce"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
gamedirname="HalfLife2Deathmatch"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Insurgency" ]; then
gamedirname="Insurgency"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Just Cause 2" ]; then
gamedirname="JustCause2"
array_configs+=( config.lua )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Killing Floor" ]; then
gamedirname="KillingFloor"
array_configs+=( Default.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead" ]; then
gamedirname="Left4Dead"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead" ]; then
gamedirname="Left4Dead"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Left 4 Dead 2" ]; then
gamedirname="Left4Dead2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Minecraft" ]; then
gamedirname="Minecraft"
array_configs+=( server.properties )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "No More Room in Hell" ]; then
gamedirname="NoMoreRoominHell"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Mumble" ]; then
:
elif [ "${gamename}" == "Natural Selection 2" ]; then
@ -268,17 +270,19 @@ elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Project Zomboid" ]; then
gamedirname="ProjectZomboid"
array_configs+=( server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Quake Live" ]; then
gamedirname="QuakeLive"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
:
elif [ "${gamename}" == "Ricochet" ]; then
@ -286,76 +290,90 @@ elif [ "${gamename}" == "Ricochet" ]; then
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_user_input_config
fn_set_config_vars
elif [ "${gamename}" == "Rust" ]; then
gamedirname="Rust"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
gamedirname="SeriousSam3BFE"
array_configs+=( server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Starbound" ]; then
gamedirname="Starbound"
array_configs+=( starbound.config )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Sven Co-op" ]; then
gamedirname="SvenCoop"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Team Fortress 2" ]; then
gamedirname="TeamFortress2"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Team Fortress Classic" ]; then
gamedirname="TeamFortressClassic"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "TeamSpeak 3" ]; then
gamedirname="TeamSpeak3"
array_configs+=( ts3server.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Teeworlds" ]; then
gamedirname="Teeworlds"
array_configs+=( server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Terraria" ]; then
gamedirname="Terraria"
array_configs+=( serverconfig.txt )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament" ]; then
gamedirname="UnrealTournament"
array_configs+=( Game.ini Engine.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
gamedirname="UnrealTournament2004"
array_configs+=( UT2004.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament 3" ]; then
gamedirname="UnrealTournament3"
array_configs+=( UTGame.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Unreal Tournament 99" ]; then
gamedirname="UnrealTournament99"
array_configs+=( Default.ini )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
gamedirname="WolfensteinEnemyTerritory"
array_configs+=( server.cfg )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fi

Loading…
Cancel
Save