Mise à jour de 'Run.sh'
This commit is contained in:
103
Run.sh
103
Run.sh
@@ -8,6 +8,9 @@ function add_iniKeyEx() {
|
||||
# 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
|
||||
}
|
||||
# !!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
|
||||
@@ -15,6 +18,9 @@ function del_iniKeyEx() {
|
||||
function add_iniKey() {
|
||||
add_iniKeyEx $CFG_FILE $1 $2 $3
|
||||
}
|
||||
function set_iniKey() {
|
||||
set_iniKeyEx $CFG_FILE $1 $2 $3
|
||||
}
|
||||
# !!Warning!! section is not considered
|
||||
function del_iniKey() {
|
||||
del_iniKeyEx $CFG_FILE $1 $2 $3
|
||||
@@ -35,49 +41,73 @@ function del_ServerActors() {
|
||||
del_iniKey 'Engine.GameEngine' ServerActors $1
|
||||
del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1
|
||||
}
|
||||
|
||||
function getmodprefix() {
|
||||
echo "XServerQuery"
|
||||
}
|
||||
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/System/ $OUTPUT_DIR/System/ --exclude '.git'
|
||||
|
||||
echo install ok
|
||||
}
|
||||
|
||||
function enable() {
|
||||
# Warning: ugly hack with sed to allow multiple key instances
|
||||
#crudini --set $OUTPUT_DIR/System/$CFG_FILE 'Engine.GameEngine' _ServerPackages $SSBBaseName
|
||||
#sed -i 's/_ServerPackages/ServerPackages/g' $OUTPUT_DIR/System/$CFG_FILE
|
||||
#crudini --set $OUTPUT_DIR/System/$CFG_FILE 'Engine.GameEngine' _ServerActors $SSBBaseName.SmartSBServerActor
|
||||
#sed -i 's/_ServerActors/ServerActors/g' $OUTPUT_DIR/System/$CFG_FILE
|
||||
# TODO
|
||||
BaseName="$(getmodprefix)"
|
||||
del_ServerActors IpServer.UdpServerQuery
|
||||
del_ServerActors 'IpServer.UdpServerUplink MasterServerAddress=utmaster.epicgames.com MasterServerPort=27900'
|
||||
del_ServerActors 'IpServer.UdpServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900'
|
||||
|
||||
add_ServerActors XServerQuery.XServerQuery
|
||||
add_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=utmaster.epicgames.com MasterServerPort=27900'
|
||||
add_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=333networks.com MasterServerPort=27900'
|
||||
add_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900'
|
||||
|
||||
echo enable ok
|
||||
}
|
||||
|
||||
function disable() {
|
||||
#sed -i "/ServerPackages[[:space:]]*=[[:space:]]*$SSBBaseName/d" $OUTPUT_DIR/System/$CFG_FILE
|
||||
#sed -i "/ServerPackages[[:space:]]*=[[:space:]]*SmartSBStats/d" $OUTPUT_DIR/System/$CFG_FILE
|
||||
#sed -i "/ServerActors[[:space:]]*=[[:space:]]*$SSBBaseName.SmartSBServerActor/d" $OUTPUT_DIR/System/$CFG_FILE
|
||||
# TODO
|
||||
BaseName="$(getmodprefix)"
|
||||
add_ServerActors IpServer.UdpServerQuery
|
||||
add_ServerActors 'IpServer.UdpServerUplink MasterServerAddress=utmaster.epicgames.com MasterServerPort=27900'
|
||||
add_ServerActors 'IpServer.UdpServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900'
|
||||
|
||||
del_ServerActors XServerQuery.XServerQuery
|
||||
del_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=utmaster.epicgames.com MasterServerPort=27900'
|
||||
del_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=333networks.com MasterServerPort=27900'
|
||||
del_ServerActors 'XServerQuery.XServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900'
|
||||
|
||||
echo disable ok
|
||||
}
|
||||
|
||||
function show_help() {
|
||||
echo
|
||||
echo "Usage: $0 { install | enable | disable } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>]"
|
||||
echo "Usage: $0 { getmodprefix | install | enable | disable } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>] [<CONFIG_KEY> <CONFIG_VALUE>]"
|
||||
echo
|
||||
}
|
||||
|
||||
function check_cfg_file() {
|
||||
if [ -z ${CFG_FILE} ]
|
||||
function check_cfg_file_config() {
|
||||
if [ $# -eq 4 ]
|
||||
then
|
||||
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
|
||||
CFG_FILE=$DEFAULT_CFG_FILE
|
||||
else
|
||||
elif [ $# -eq 5 ]
|
||||
then
|
||||
echo "CFG_FILE is set to '$CFG_FILE'"
|
||||
else
|
||||
echo "Wrong number of arguments"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
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_cfg_file_gen() {
|
||||
if [ -z ${CFG_FILE} ]
|
||||
then
|
||||
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
|
||||
CFG_FILE=$DEFAULT_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"
|
||||
@@ -85,37 +115,38 @@ function check_cfg_file() {
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
}
|
||||
|
||||
function check_game_dir() {
|
||||
### Check if a directory does not exist ###
|
||||
if [ ! -d $OUTPUT_DIR ]
|
||||
if [ -z $OUTPUT_DIR ]
|
||||
then
|
||||
echo "incorrect <UT99_INSTALL_DIR>"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'install')
|
||||
'getmodprefix')
|
||||
check_game_dir
|
||||
install
|
||||
getmodprefix
|
||||
;;
|
||||
'install')
|
||||
check_game_dir "$@"
|
||||
install "$@"
|
||||
;;
|
||||
'enable')
|
||||
check_game_dir
|
||||
check_cfg_file
|
||||
disable
|
||||
enable
|
||||
check_game_dir "$@"
|
||||
check_cfg_file_gen "$@"
|
||||
disable "$@"
|
||||
enable "$@"
|
||||
;;
|
||||
'disable')
|
||||
check_game_dir
|
||||
check_cfg_file
|
||||
disable
|
||||
check_game_dir "$@"
|
||||
check_cfg_file_gen "$@"
|
||||
disable "$@"
|
||||
;;
|
||||
*)
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user