Files
COD4-Maps-FFA/Run.sh
chacha 86fae28ec9 Update Run.sh
tmporary disable map injectino in mod
2023-10-02 09:59:54 +02:00

50 lines
1.2 KiB
Bash

#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
OUTPUT_DIR="$2"
MOD_NAME="$3"
function install() {
echo "SRC dir: $SCRIPT_DIR"
echo "DEST dir: $OUTPUT_DIR"
rsync -a $SCRIPT_DIR/usermaps/ $OUTPUT_DIR/usermaps/ --exclude '.git'
# rsync -a $SCRIPT_DIR/usermaps/ $OUTPUT_DIR/usermaps/ --exclude '.git' --exclude '*.iwd'
# tempdir=$(mktemp -d)
# find $SCRIPT_DIR/usermaps/ -type f -name \*.iwd | rsync -avh --files-from - --no-relative / $tempdir
# find $tempdir -type f -name '*.iwd' -print0 | xargs --no-run-if-empty -0 basename -a | xargs -I@ mv $tempdir/@ $tempdir/zzz_@
# rsync -avh $tempdir/ $OUTPUT_DIR/mods/$MOD_NAME
# rm -Rf "$tempdir" ||:
echo install ok
}
function show_help() {
echo
echo "Usage: $0 { install } <COD_INSTALL_DIR> <MOD_NAME>"
echo "Note: <MOD_NAME> is mandatory because custom map needs a mod (even empty)"
echo
}
function check_game_dir() {
### Check if a directory does not exist ###
if [ -z $OUTPUT_DIR ]
then
echo "incorrect <COD_INSTALL_DIR>"
show_help
exit 9999 # die with error code 9999
fi
}
case "$1" in
'install')
check_game_dir
install
;;
*)
show_help
exit 1
;;
esac
exit 0