From 33f99989bf01c73f48e3c2c1557afa6b468b3828 Mon Sep 17 00:00:00 2001 From: Danaak Date: Thu, 1 Nov 2018 10:27:03 -0700 Subject: [PATCH 1/2] Allow snapshots to download --- init/msm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init/msm b/init/msm index f1b96a1b..3778927d 100755 --- a/init/msm +++ b/init/msm @@ -28,7 +28,7 @@ # The Minecraft Server Manager version, use "msm version" to check yours. -VERSION="0.9.9" +VERSION="0.9.10" # Source, if it exists, the msm profile.d script if [ -f "/etc/profile.d/msm.sh" ]; then @@ -1101,16 +1101,15 @@ jargroup_getlatest() { # This method allows for backwards compatibility with previous releases local target="$(as_user "$SETTINGS_USERNAME" "cat $SETTINGS_JAR_STORAGE_PATH/$1/$SETTINGS_JARGROUP_TARGET")" if [[ "$target" =~ ^minecraft ]]; then - if [[ "$target" == "minecraft" ]]; then - local versions_target="release" - elif [[ "$target" == "minecraft-snapshot" ]]; then + local versions_target="release" + if [[ "$target" == "minecraft-snapshot" ]]; then local versions_target="snapshot" fi printf "Checking minecraft version JSON... " local versions_url="https://launchermeta.mojang.com/mc/game/version_manifest.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_package_url=$(as_user "$SETTINGS_USERNAME" "cat $versions_file | jq -r '.versions | sort_by(.releaseTime) | map(select(.type | contains ("\""release"\""))) | last | .url'") + 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'") local latest_version=$(as_user "$SETTINGS_USERNAME" "echo ${latest_package_url##*/} | sed s/.json//") if [[ -n "$latest_package_url" ]]; then From 91dd313739afbccc9c7574a644ac0ab86fdcdcf3 Mon Sep 17 00:00:00 2001 From: Danaak <732831+danaak@users.noreply.github.com> Date: Thu, 1 Nov 2018 11:54:56 -0700 Subject: [PATCH 2/2] Check if jq is installed and cancel with message on failure --- init/msm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init/msm b/init/msm index 3778927d..ba66ad18 100755 --- a/init/msm +++ b/init/msm @@ -1105,6 +1105,14 @@ jargroup_getlatest() { if [[ "$target" == "minecraft-snapshot" ]]; then local versions_target="snapshot" fi + + # Check if jq is installed on the local computer + as_user "$SETTINGS_USERNAME" "which jq > /dev/null" + if [[ "$?" != "0" ]]; then + echo "jq is required to download server updates. Please ensure it is installed and the path is set correctly." + return 1 + fi + printf "Checking minecraft version JSON... " local versions_url="https://launchermeta.mojang.com/mc/game/version_manifest.json" local versions_file="/tmp/minecraft_versions.json"