@@ -6,58 +6,17 @@ isDebugging && set -x
6
6
7
7
: " ${VANILLA_VERSION?} "
8
8
9
- magmaHandleInstaller () {
10
- url=${1?}
11
- tagName=${2?}
12
- markerFile=${3?}
13
-
14
- installerFile=" magma-installer-${VANILLA_VERSION} -${tagName} .jar"
15
- log " Downloading Magma installer file for ${VANILLA_VERSION} @ ${tagName} "
16
- if ! curl -o " $installerFile " -fsSL " $url " ; then
17
- log " ERROR failed to download Magma installer from $url (status=$? )"
18
- exit 1
19
- fi
20
-
21
- echo " forge" > " $markerFile "
22
-
23
- export FORGE_INSTALLER=" $installerFile "
24
- export FORGE_INSTALLER_CUSTOM_VERSION=" $tagName "
25
-
26
- # now hand off the rest to forge
27
- exec ${SCRIPTS:-/ } start-deployForge " $@ "
28
- }
29
-
30
- latestMeta=$( curl -fsSL https://api.magmafoundation.org/api/v2/${VANILLA_VERSION} /latest || exit $? )
31
- if [ $? != 0 ]; then
32
- log " ERROR failed to locate latest Magma info for ${VANILLA_VERSION} (error=$? )"
9
+ if ! downloadUrl=$( get --json-path ' $.link' " https://api.magmafoundation.org/api/v2/${VANILLA_VERSION} /latest" ) ; then
10
+ log " ERROR failed to locate latest Magma download for ${VANILLA_VERSION} . Is that version supported?"
33
11
exit 1
34
12
fi
35
13
36
- tagName=$( echo " ${latestMeta} " | jq -r ' .tag_name' )
37
- markerFile=" .magma-installed-${VANILLA_VERSION} -${tagName} "
38
- if [ -f " ${markerFile} " ]; then
39
- installedTagName=$( cat " ${markerFile} " )
40
- fi
41
-
42
- if [ ! -f " ${markerFile} " ]; then
43
- assetUrl=$( echo " ${latestMeta} " | jq -r " .installer_link" )
44
- if [ $? != 0 ] || [ -z " $assetUrl " ]; then
45
- log " ERROR failed to extract installer for ${VANILLA_VERSION} tag ${tagName} "
46
- exit 1
47
- fi
48
-
49
- magmaHandleInstaller " $assetUrl " " $tagName " " $markerFile "
50
- else
51
- export SERVER=$( cat " ${markerFile} " )
52
-
53
- if [[ $SERVER == " forge" ]]; then
54
- export FORGE_INSTALLER=" magma-installer-${VANILLA_VERSION} -${tagName} .jar"
55
- export FORGE_INSTALLER_CUSTOM_VERSION=" $tagName "
56
- # now hand off the rest to forge
57
- exec ${SCRIPTS:-/ } start-deployForge " $@ "
58
- fi
14
+ if ! SERVER=$( get --output-filename --skip-up-to-date --output /data " $downloadUrl " ) ; then
15
+ log " ERROR: failed to download Magma server jar from $downloadUrl "
16
+ exit 1
59
17
fi
60
18
19
+ export SERVER
61
20
export FAMILY=HYBRID
62
21
63
22
exec " ${SCRIPTS:-/ } start-setupWorld" " $@ "
0 commit comments