Mise à jour de 'Run.sh'

add getmodprefix cmd
This commit is contained in:
2022-07-18 18:07:50 +00:00
parent 161f59b51c
commit 1ecb03bc2e

26
Run.sh
View File

@@ -41,6 +41,11 @@ function del_ServerActors() {
del_iniKey 'Engine.GameEngine' ServerActors $1
del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1
}
function getmodprefix() {
UFile=$(find $OUTPUT_DIR/System -type f -iname "niut*.u" -exec basename {} \;)
BaseName="${UFile%.*}"
echo "$BaseName"
}
function install() {
rsync -a $SCRIPT_DIR/Help/ $OUTPUT_DIR/Help/ --exclude '.git'
rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System/ --exclude '.git'
@@ -48,19 +53,14 @@ function install() {
echo install ok
}
function enable() {
NIUTUFile=$(find $OUTPUT_DIR/System -type f -iname "niut*.u" -exec basename {} \;)
NIUTBaseName="${NIUTUFile%.*}"
add_ServerPackage $NIUTBaseName
BaseName="$(getmodprefix)"
add_ServerPackage $BaseName
echo enable ok
}
function disable() {
NIUTUFile=$(find $OUTPUT_DIR/System -type f -iname "niut*.u" -exec basename {} \;)
echo $NIUTUFile
NIUTBaseName="${NIUTUFile%.*}"
echo $NIUTBaseName
del_ServerPackage $NIUTBaseName
BaseName="$(getmodprefix)"
del_ServerPackage $BaseName
echo disable ok
}
@@ -93,7 +93,7 @@ function config() {
}
function show_help() {
echo
echo "Usage: $0 { install | enable | disable | config } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>] [<CONFIG_KEY> <CONFIG_VALUE>]"
echo "Usage: $0 { getmodprefix | install | enable | disable | config } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>] [<CONFIG_KEY> <CONFIG_VALUE>]"
echo
}
function check_cfg_file_config() {
@@ -133,7 +133,7 @@ function check_cfg_file_gen() {
}
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
@@ -141,6 +141,10 @@ function check_game_dir() {
fi
}
case "$1" in
'getmodprefix')
check_game_dir
getmodprefix
;;
'install')
check_game_dir "$@"
install "$@"