Mise à jour de 'Run.sh'

This commit is contained in:
2022-11-13 16:40:01 +01:00
parent 1ecb03bc2e
commit 4895e6f68f

21
Run.sh
View File

@@ -3,6 +3,8 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
OUTPUT_DIR="$2" OUTPUT_DIR="$2"
CFG_FILE="$3" CFG_FILE="$3"
DEFAULT_CFG_FILE=NIUT.ini DEFAULT_CFG_FILE=NIUT.ini
DEFAULT_INSTALL_CFG_FILE=UnrealTournament.ini
function add_iniKeyEx() { function add_iniKeyEx() {
crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4 crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4
# Warning: ugly hack with sed to allow multiple key instances + to remove space around '=' # Warning: ugly hack with sed to allow multiple key instances + to remove space around '='
@@ -131,6 +133,21 @@ function check_cfg_file_gen() {
exit 9999 # die with error code 9999 exit 9999 # die with error code 9999
fi fi
} }
function check_cfg_file_gen2() {
if [ -z ${CFG_FILE} ]
then
echo "CFG_FILE is unset, setting it to $DEFAULT_INSTALL_CFG_FILE"
CFG_FILE=$DEFAULT_INSTALL_CFG_FILE
else
echo "CFG_FILE is set to '$CFG_FILE'"
fi
if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ]
then
echo "$OUTPUT_DIR/System/$CFG_FILE does not exist"
show_help
exit 9999 # die with error code 9999
fi
}
function check_game_dir() { function check_game_dir() {
### Check if a directory does not exist ### ### Check if a directory does not exist ###
if [ -z $OUTPUT_DIR ] if [ -z $OUTPUT_DIR ]
@@ -151,7 +168,7 @@ case "$1" in
;; ;;
'enable') 'enable')
check_game_dir "$@" check_game_dir "$@"
check_cfg_file_gen "$@" check_cfg_file_gen2 "$@"
disable "$@" disable "$@"
enable "$@" enable "$@"
;; ;;
@@ -162,7 +179,7 @@ case "$1" in
;; ;;
'disable') 'disable')
check_game_dir "$@" check_game_dir "$@"
check_cfg_file_gen "$@" check_cfg_file_gen2 "$@"
disable "$@" disable "$@"
;; ;;
*) *)