-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_map.sh
executable file
·61 lines (58 loc) · 1.26 KB
/
install_map.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
set -e
TARGET="$HOME/Programs/UnrealTournament"
if [ -d "$TARGET/drive_c/UnrealTournament" ]; then
TARGET="$TARGET/drive_c/UnrealTournament"
fi
function do_install {
local ARCHIVE=$(basename $1)
local WORK=$(mktemp -d umod.XXXXXX)
unzip -q "$1" -d "$WORK"
find "$WORK" -type f | while read FILE; do
case "${FILE##*.}" in
unr)
echo "copy $ARCHIVE/${FILE#$WORK/}"
cp "$FILE" "$TARGET/Maps"
;;
utx)
echo "copy $ARCHIVE/${FILE#$WORK/}"
cp "$FILE" "$TARGET/Textures"
;;
umx)
echo "copy $ARCHIVE/${FILE#$WORK/}"
cp "$FILE" "$TARGET/Music"
;;
uax)
echo "copy $ARCHIVE/${FILE#$WORK/}"
cp "$FILE" "$TARGET/Sounds"
;;
u|int|ini)
echo "copy $ARCHIVE/${FILE#$WORK/}"
cp "$FILE" "$TARGET/System"
;;
umod)
echo "$(tput setaf 6)umod$(tput sgr0) $ARCHIVE/${FILE#$WORK/}"
umod -b "$TARGET" -i "$FILE"
;;
txt|htm|html|jpg)
echo "$(tput setaf 8)skipping$(tput sgr0) $ARCHIVE/${FILE#$WORK/}"
;;
*)
echo "$(tput setaf 1)unhandled$(tput sgr0) $ARCHIVE/${FILE#$WORK/}"
;;
esac
done
rm -rf "$WORK"
}
while [[ $# > 0 ]]; do
arg="$1"
case "$arg" in
--target)
TARGET="`realpath "$2"`"
shift
;;
*)
do_install "$arg"
;;
esac
shift
done