-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-common-maps.sh
executable file
·60 lines (51 loc) · 1.42 KB
/
install-common-maps.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
#!/usr/bin/env bash
# Script that downloads common maps for Wolfenstein Enemy Territory from internet.
WET_USER='wet'
WET_DIR="/srv/${WET_USER}"
MAPS_URL='http://legacy.murda.eu/downloads/wet/maps/'
# You need root permissions to run this script.
if [[ "${UID}" != '0' ]]; then
echo '> You need to become root to run this script.'
echo '> Aborting.'
exit 1
fi
if ! command -v wget 1> /dev/null 2>&1; then
echo "> Unable to find wget from your environment's PATH variable."
echo '> Aborting.'
exit 1
fi
if [[ ! -d "${WET_DIR}" ]] || [[ ! -d "${WET_DIR}/etmain" ]]; then
echo "> Destination directory doesn't exist (${WET_DIR}/etmain)."
echo '> Aborting.'
exit 1
fi
MAPS=( \
'adlernest.pk3' \
'braundorf_b4.pk3' \
'bremen_b2.pk3' \
'caen2.pk3' \
'et_beach.pk3' \
'et_ice.pk3' \
'frostbite.pk3' \
'karsiah_te2.pk3' \
'missile_b3.pk3' \
'reactor_final.pk3' \
'sp_delivery_te.pk3' \
'supply.pk3' \
'sw_battery.pk3' \
'sw_goldrush_te.pk3' \
'tc_base.pk3' \
'te_valhalla.pk3' \
'tournementdm2.pk3' \
)
for MAP in "${MAPS[@]}"
do
if [[ ! -f "${WET_DIR}/etmain/${MAP}" ]]; then
wget "${MAPS_URL}${MAP}" -O "${WET_DIR}/etmain/${MAP}"
fi
done
# Last correction for ownership and permissions.
chown -R "${WET_USER}:${WET_USER}" "${WET_DIR}"
chmod -R o-rwx "${WET_DIR}"
# Let user know that script has finished its job.
echo '> Finished.'