fix Run.sh
This commit is contained in:
45
Run.sh
Normal file → Executable file
45
Run.sh
Normal file → Executable file
@@ -3,6 +3,8 @@
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
OUTPUT_DIR="$2"
|
||||
CFG_FILE="$3"
|
||||
DEFAULT_CFG_FILE=UnrealTournament.ini
|
||||
|
||||
|
||||
function install() {
|
||||
cp $SCRIPT_DIR/Help $OUTPUT_DIR/Help -R
|
||||
@@ -11,16 +13,36 @@ function install() {
|
||||
}
|
||||
|
||||
function enable() {
|
||||
SSBVersion=$(find $OUTPUT_DIR/System -type f -iname "SmartSB*.u")
|
||||
echo $SSBVersion
|
||||
SSBUFile=$(find $OUTPUT_DIR/System -type f -iname "SmartSB*.u" ! -name "SmartSBStats.u" -exec basename {} \;)
|
||||
SSBBaseName="${SSBUFile%.*}"
|
||||
|
||||
# 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' _ServerPackages SmartSBStats
|
||||
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
|
||||
|
||||
echo enable ok
|
||||
}
|
||||
|
||||
function disable() {
|
||||
SSBUFile=$(find $OUTPUT_DIR/System -type f -iname "SmartSB*.u" ! -name "SmartSBStats.u" -exec basename {} \;)
|
||||
SSBBaseName="${SSBUFile%.*}"
|
||||
|
||||
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
|
||||
|
||||
echo disable ok
|
||||
}
|
||||
|
||||
function show_help() {
|
||||
echo
|
||||
echo "Usage: $0 { install | enable | disable } <UT99_INSTALL_DIR>"
|
||||
echo "Usage: $0 { install | enable | disable } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>]"
|
||||
echo
|
||||
}
|
||||
|
||||
@@ -32,6 +54,23 @@ then
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
|
||||
### handle config file
|
||||
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
|
||||
|
||||
### Check config file exists
|
||||
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
|
||||
|
||||
case "$1" in
|
||||
'install')
|
||||
install
|
||||
|
||||
Reference in New Issue
Block a user