-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuildupdate.sh
More file actions
executable file
·78 lines (67 loc) · 1.66 KB
/
Copy pathbuildupdate.sh
File metadata and controls
executable file
·78 lines (67 loc) · 1.66 KB
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
78
#!/bin/bash
function copyUpdateData() {
version="$1"
channel="$2"
# Create directory
mkdir -p "build/updatedata/emuferal.ddns.net/httpdocs/$channel" || exit 1
# Copy files
function copyData() {
for file in $1/* ; do
pref=$2
targetf="${file:${#pref}}"
if [ -f "$file" ]; then
dir="$(dirname "build/updatedata/emuferal.ddns.net/httpdocs/$channel/${version}/${targetf}")"
if [ ! -d "$dir" ]; then
mkdir -p "$dir" || exit 1
fi
cp -rfv "$file" "build/updatedata/emuferal.ddns.net/httpdocs/$channel/${version}/${targetf}"
fi
if [ "$?" != "0" ]; then
echo Build failure!
exit 1
fi
if [ -d "$file" ]; then
copyData "$file" "$2"
fi
done
}
copyData build/update build/update/
echo -n "$version" > "build/updatedata/emuferal.ddns.net/httpdocs/$channel/update.info"
source version.info
}
# Current channel
echo Preparing...
source version.info
rm -rf build/updatedata
rm -rf build/update
echo
echo
echo Centuria Update Builder
echo Version: $version
echo Version type: $channel
echo
echo
read -p "Are you sure you want to build this version's update files? [Y/n] " prompt
if [ "$prompt" != "y" ] && [ "$prompt" != "Y" ]; then
exit
fi
echo Building centuria...
./gradlew build updateData || exit $?
echo
echo Copying data...
copyUpdateData "$version" "$channel"
# Other channels
if [ "$channel" == "beta" ]; then
copyUpdateData "$version" alpha
fi
if [ "$channel" == "prerelease" ]; then
copyUpdateData "$version" alpha
copyUpdateData "$version" beta
fi
if [ "$channel" == "release" ]; then
copyUpdateData "$version" alpha
copyUpdateData "$version" beta
copyUpdateData "$version" prerelease
fi
echo
echo Build completed.