-
Notifications
You must be signed in to change notification settings - Fork 1
/
updatemods.sh
executable file
·79 lines (65 loc) · 1.65 KB
/
updatemods.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#Setup some variables to handle colored text
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m'
#This is the installation directory of your azerothcore. Do NOT use a tilda ~ when referencing the installation directory; this will cause the script to fail
INSTALL_DIR="/root/azerothcore-wotlk"
BUILD_DIR="/var/build"
COMPILE_TYPE=
#Variables for command-line options. Update as needed.
COMPILE_CMD='./acore.sh compiler all'
BUILD_CMD='./acore.sh compiler build'
cd $INSTALL_DIR
#Prompt user for correct usage of update script
usage()
{
echo "Usage ./updatemods.sh [-d] [-c build | compile]";
exit 0
}
#Update function for AzerothCore and all modules
update_az()
{
echo -e "${YELLOW}Updating Azerothcore${NC}"
git pull
cd $INSTALL_DIR/modules
for f in *; do
if [ -d "$f" ]; then
# Will not run if no directories are available
echo -e "Updating mod ${CYAN}$f...${NC}"
git pull
fi
done
}
#Call the update function
update_az
while getopts "hdc:" opt; do
case $opt in
d)
echo -e "${YELLOW}Deleting build directory${NC}"
rm -rf $INSTALL_DIR$BUILD_DIR
;;
c)
COMPILE_TYPE=${OPTARG,,}
case $COMPILE_TYPE in
compile)
echo -e "${YELLOW}Compiling with the all option${NC}"
cd $INSTALL_DIR
$COMPILE_CMD
;;
build)
echo -e "${YELLOW}Compiling with the build option${NC}"
cd $INSTALL_DIR
$BUILD_CMD
;;
*)
usage
;;
esac
;;
h | *)
usage
;;
esac
done
shift $((OPTIND-1))