fix config ini

This commit is contained in:
2022-07-17 20:00:08 +02:00
parent 2e46a073e2
commit 161f59b51c

19
Run.sh
View File

@@ -2,14 +2,14 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
OUTPUT_DIR="$2"
CFG_FILE="$3"
DEFAULT_CFG_FILE=UnrealTournament.ini
DEFAULT_CFG_FILE=NIUT.ini
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:]]*__$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*/$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')=/g" $OUTPUT_DIR/System/$1
}
function set_iniKeyEx() {
crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4
crudini --set $OUTPUT_DIR/System/$1 $2 $3 $4
}
# !!Warning!! section is not considered
function del_iniKeyEx() {
@@ -42,8 +42,8 @@ function del_ServerActors() {
del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1
}
function install() {
rsync -a $SCRIPT_DIR/Help/ $OUTPUT_DIR/Help/ --exclude '.git'
rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System/ --exclude '.git'
rsync -a $SCRIPT_DIR/Help/ $OUTPUT_DIR/Help/ --exclude '.git'
rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System/ --exclude '.git'
echo install ok
}
@@ -56,7 +56,9 @@ function enable() {
}
function disable() {
NIUTUFile=$(find $OUTPUT_DIR/System -type f -iname "niut*.u" -exec basename {} \;)
echo $NIUTUFile
NIUTBaseName="${NIUTUFile%.*}"
echo $NIUTBaseName
del_ServerPackage $NIUTBaseName
@@ -78,11 +80,14 @@ function config() {
exit 1
;;
esac
NIUT_FileName=$(find $OUTPUT_DIR/System -type f -iname "NIUT*.ini" -exec basename {} \;)
NIUT_BaseFileName="${NIUT%.*}"
NIUTUFile=$(find $OUTPUT_DIR/System -type f -iname "niut*.u" -exec basename {} \;)
echo $NIUTUFile
NIUTBaseName="${NIUTUFile%.*}"
echo $NIUTBaseName
case "$OptionKey" in
*)
set_iniKeyEx NIUT.ini "$NIUT_BaseFileName.NIUTMutator" $OptionKey $OptionValue
set_iniKeyEx NIUT.ini "${NIUTBaseName^^}.NIUTMutator" $OptionKey $OptionValue
;;
esac
}