mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
check for release or snapshot and get latest appropriate version
This commit is contained in:
parent
f3981cf6d4
commit
23e3fbcd05
7
init/msm
7
init/msm
@ -1073,14 +1073,15 @@ jargroup_getlatest() {
|
||||
wget_opts=""
|
||||
fi
|
||||
|
||||
# If target contains the word 'minecraft' check JSON version file for correct filename
|
||||
# If target contains the word 'release' or 'snapshot' check JSON version file for correct filename
|
||||
# Look for Latest tag to find the latest snapshot and release. Not sure what happens in the JSON after a snapshot is released though...
|
||||
local target="$(as_user "$SETTINGS_USERNAME" "cat $SETTINGS_JAR_STORAGE_PATH/$1/$SETTINGS_JARGROUP_TARGET")"
|
||||
if [[ "$target" == "minecraft" ]]; then
|
||||
if [[ "$target" == "release" ]] || [[ "$target" == "snapshot" ]]; then
|
||||
printf "Checking minecraft version JSON... "
|
||||
local versions_url="http://s3.amazonaws.com/Minecraft.Download/versions/versions.json"
|
||||
local versions_file="/tmp/minecraft_versions.json"
|
||||
as_user "$SETTINGS_USERNAME" "wget --quiet $wget_opts --no-check-certificate -O '$versions_file' '$versions_url'"
|
||||
local latest_version=$(as_user "$SETTINGS_USERNAME" "cat '$versions_file' | egrep '^[[:space:]]*\"release\"' | cut -d':' -f2 | egrep -o '[[:digit:].]*'")
|
||||
local latest_version=$(as_user "$SETTINGS_USERNAME" "sed -n '/"latest"/,/}/p' $versions_file | grep $target | egrep -o '([0-9]+\.?)+|([0-9]+[a-zA-Z])+'")
|
||||
if [[ -n "$latest_version" ]]; then
|
||||
local jar_url="https://s3.amazonaws.com/Minecraft.Download/versions/$latest_version/minecraft_server.$latest_version.jar"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user