-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
update.sh
executable file
·117 lines (98 loc) · 3.67 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
BASEDIR=$(dirname "$0")
cd "${BASEDIR}"
BASEDIR=`pwd`
set -x
source config.sh
if [ -f config/config_local.sh ]; then
source config/config_local.sh
fi
MODE=${MODE:-develop}
S3_BUCKET_var="S3_$MODE"
S3_BUCKET="${!S3_BUCKET_var}"
BRANCH_var="BRANCH_$MODE"
BRANCH="${!BRANCH_var}"
function fail_in {
cd "${BASEDIR}/${UPSTREAM_DIR}"
git reset --hard HEAD
exit 1
}
function fail_out {
cd "${BASEDIR}/${MMC_DIR}"
git reset --hard HEAD
exit 1
}
currentDate=`date --iso-8601`
cd "${BASEDIR}/${UPSTREAM_DIR}"
git reset --hard HEAD || exit 1
git checkout ${BRANCH} || exit 1
cd "${BASEDIR}"
./updateMojang.py || fail_in
./updateForge.py || fail_in
./updateNeoforge.py || fail_in
./updateFabric.py || fail_in
./updateQuilt.py || fail_in
./updateLiteloader.py || fail_in
if [ "${DEPLOY_TO_GIT}" = true ] ; then
cd "${BASEDIR}/${UPSTREAM_DIR}"
git add mojang/version_manifest_v2.json mojang/versions/* mojang/assets/* || fail_in
git add forge/*.json forge/version_manifests/*.json forge/installer_manifests/*.json forge/files_manifests/*.json forge/installer_info/*.json || fail_in
git add neoforge/*.json neoforge/version_manifests/*.json neoforge/installer_manifests/*.json neoforge/files_manifests/*.json neoforge/installer_info/*.json || fail_in
git add fabric/loader-installer-json/*.json fabric/meta-v2/*.json fabric/jars/*.json || fail_in
git add quilt/loader-installer-json/*.json quilt/meta-v3/*.json quilt/jars/*.json || fail_in
git add liteloader/*.json || fail_in
if ! git diff --cached --exit-code ; then
git commit -a -m "Update ${currentDate}" || fail_in
GIT_SSH_COMMAND="ssh -i ${BASEDIR}/config/meta-upstream.key" git push || exit 1
fi
cd "${BASEDIR}"
fi
cd "${BASEDIR}/${MMC_DIR}"
git reset --hard HEAD || exit 1
git checkout ${BRANCH} || exit 1
cd "${BASEDIR}"
./generateMojang.py || fail_out
./generateForge.py || fail_out
./generateNeoforge.py || fail_out
./generateFabric.py || fail_out
./generateQuilt.py || fail_out
./generateLiteloader.py || fail_out
./index.py || fail_out
if [ "${DEPLOY_TO_GIT}" = true ] ; then
cd "${BASEDIR}/${MMC_DIR}"
git add index.json org.lwjgl/* net.minecraft/* || fail_out
git add net.minecraftforge/* || fail_out
git add net.neoforged/* || fail_out
git add net.fabricmc.fabric-loader/* net.fabricmc.intermediary/* || fail_out
git add org.quiltmc.quilt-loader/* || fail_out
git add com.mumfrey.liteloader/* || fail_out
if [ -d "org.lwjgl3" ]; then
git add org.lwjgl3/* || fail_out
fi
if ! git diff --cached --exit-code ; then
git commit -a -m "Update ${currentDate}" || fail_out
GIT_SSH_COMMAND="ssh -i ${BASEDIR}/config/meta-multimc.key" git push || exit 1
fi
fi
if [ "${UPDATE_FORGE_MAVEN}" = true ] ; then
echo "Updating the copy of Forge maven"
cd "${BASEDIR}"
./enumerateForge.py
if [ "${DEPLOY_FORGE_MAVEN}" = true ] ; then
chown -RL ${DEPLOY_FOLDER_USER}:${DEPLOY_FOLDER_GROUP} ${BASEDIR}/forgemaven/
if [ "${DEPLOY_FORGE_MAVEN_S3}" = true ] ; then
s3cmd -c ${BASEDIR}/config/s3cmd.cfg --exclude=".git*" --delete-removed sync ${BASEDIR}/forgemaven/ ${S3_FORGE_MAVEN} || exit 2
fi
fi
fi
cd "${BASEDIR}"
if [ "${DEPLOY_TO_FOLDER}" = true ] ; then
DEPLOY_FOLDER_var="DEPLOY_FOLDER_$MODE"
DEPLOY_FOLDER="${!DEPLOY_FOLDER_var}"
echo "Deploying to ${DEPLOY_FOLDER}"
rsync -rvog --chown=${DEPLOY_FOLDER_USER}:${DEPLOY_FOLDER_GROUP} --exclude=.git ${BASEDIR}/${MMC_DIR}/ ${DEPLOY_FOLDER}
fi
if [ "${DEPLOY_TO_S3}" = true ] ; then
s3cmd -c ${BASEDIR}/config/s3cmd.cfg --exclude=".git*" --delete-removed sync ${BASEDIR}/${MMC_DIR}/ ${S3_BUCKET} || exit 2
fi
exit 0