diff --git a/Run.sh b/Run.sh index 851d3e6..a74769e 100755 --- a/Run.sh +++ b/Run.sh @@ -1,35 +1,39 @@ #!/bin/bash - SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) OUTPUT_DIR="$2" CFG_FILE="$3" DEFAULT_CFG_FILE=UnrealTournament.ini - -function add_iniKey() { - crudini --set $OUTPUT_DIR/System/$CFG_FILE $1 __$2 $3 +function add_iniKeyEx() { + crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4 # Warning: ugly hack with sed to allow multiple key instances + to remove space around '=' - sed -i "s/[[:space:]]*__$2[[:space:]]*=[[:space:]]*/$2=/g" $OUTPUT_DIR/System/$CFG_FILE + sed -i "s/[[:space:]]*__$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*/$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')=/g" $OUTPUT_DIR/System/$1 +} +# !!Warning!! section is not considered +function del_iniKeyEx() { + sed -i "/[[:space:]]*$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*$(echo $4 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/d" $OUTPUT_DIR/System/$1 +} +function add_iniKey() { + add_iniKeyEx $CFG_FILE $1 $2 $3 } - # !!Warning!! section is not considered function del_iniKey() { - sed -i "/[[:space:]]*$2[[:space:]]*=[[:space:]]*$3/d" $OUTPUT_DIR/System/$CFG_FILE + del_iniKeyEx $CFG_FILE $1 $2 $3 } - function add_ServerPackage() { add_iniKey 'Engine.GameEngine' ServerPackages $1 + add_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1 } - function del_ServerPackage() { del_iniKey 'Engine.GameEngine' ServerPackages $1 + del_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1 } - function add_ServerActors() { add_iniKey 'Engine.GameEngine' ServerActors $1 + add_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1 } - function del_ServerActors() { del_iniKey 'Engine.GameEngine' ServerActors $1 + del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1 } function install() {