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. 104
      lgsm/functions/install_config.sh

104
lgsm/functions/install_config.sh

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

Loading…
Cancel
Save