Skip to content

Commit 1b93ba8

Browse files
authored
Merge pull request #369 from danaak/master
Allow snapshots to be downloaded
2 parents 3d6f46e + 91dd313 commit 1b93ba8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

init/msm

+12-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
# The Minecraft Server Manager version, use "msm version" to check yours.
31-
VERSION="0.9.9"
31+
VERSION="0.9.10"
3232

3333
# Source, if it exists, the msm profile.d script
3434
if [ -f "/etc/profile.d/msm.sh" ]; then
@@ -1101,16 +1101,23 @@ jargroup_getlatest() {
11011101
# This method allows for backwards compatibility with previous releases
11021102
local target="$(as_user "$SETTINGS_USERNAME" "cat $SETTINGS_JAR_STORAGE_PATH/$1/$SETTINGS_JARGROUP_TARGET")"
11031103
if [[ "$target" =~ ^minecraft ]]; then
1104-
if [[ "$target" == "minecraft" ]]; then
1105-
local versions_target="release"
1106-
elif [[ "$target" == "minecraft-snapshot" ]]; then
1104+
local versions_target="release"
1105+
if [[ "$target" == "minecraft-snapshot" ]]; then
11071106
local versions_target="snapshot"
11081107
fi
1108+
1109+
# Check if jq is installed on the local computer
1110+
as_user "$SETTINGS_USERNAME" "which jq > /dev/null"
1111+
if [[ "$?" != "0" ]]; then
1112+
echo "jq is required to download server updates. Please ensure it is installed and the path is set correctly."
1113+
return 1
1114+
fi
1115+
11091116
printf "Checking minecraft version JSON... "
11101117
local versions_url="https://launchermeta.mojang.com/mc/game/version_manifest.json"
11111118
local versions_file="/tmp/minecraft_versions.json"
11121119
as_user "$SETTINGS_USERNAME" "wget --quiet $wget_opts --no-check-certificate -O '$versions_file' '$versions_url'"
1113-
local latest_package_url=$(as_user "$SETTINGS_USERNAME" "cat $versions_file | jq -r '.versions | sort_by(.releaseTime) | map(select(.type | contains ("\""release"\""))) | last | .url'")
1120+
local latest_package_url=$(as_user "$SETTINGS_USERNAME" "cat $versions_file | jq -r '.versions | sort_by(.releaseTime) | map(select(.type | contains ("\""$versions_target"\""))) | last | .url'")
11141121
local latest_version=$(as_user "$SETTINGS_USERNAME" "echo ${latest_package_url##*/} | sed s/.json//")
11151122

11161123
if [[ -n "$latest_package_url" ]]; then

0 commit comments

Comments
 (0)