-
Notifications
You must be signed in to change notification settings - Fork 6
/
update.sh
executable file
·58 lines (42 loc) · 1.05 KB
/
update.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
#!/bin/bash
# Usage: ./update /path/cstrike/ <URL> --snapshot-dev --snapshot-stable --install --dontask --fixpermissions
# change to the script's directory
cd $(dirname "$(readlink -f "$0")")
# load all functions
for f in $(find functions/ -name '*.func'); do
. "$f"
done
define_colors
echo -e "$header Bcserv Sourcemod updater $reset"
echo ""
# declare associative array for the options, as bash can't
# serialize this into the ENV, it is defined here.
declare -A options
# read the options in
read_options $*
# load settings
. "settings"
directory_game="$1"
if [[ $2 != "" && ${2:0:2} != "--" ]]; then
url_sourcemod_package="$2"
fi
if [[ ${options[help]} == "1" || $directory_game == "" ]]; then
help
exit 0
fi
download
if [[ $? == 1 ]]; then
if [[ ${options[dontask]} != "1" ]]; then
echo -e "${cyan}I will do the update now, press any key to continue${reset}, $red'CTRL + C' to exit$reset"
echo ""
stty -echo
read -n 1
stty echo
fi
update
if [[ $? == 0 ]]; then
echo -e "${red}Error found, aborting."
fi
# Cleanup
rm -R "$temp"
fi