Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version target correction #298

Merged
merged 3 commits into from
Jul 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions init/msm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


# The Minecraft Server Manager version, use "msm version" to check yours.
VERSION="0.9.0"
VERSION="0.9.1"


# Source, if it exists, the msm profile.d script
Expand Down Expand Up @@ -1104,15 +1104,20 @@ jargroup_getlatest() {
wget_opts=""
fi

# 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...
# If target contains the word 'minecraft' or 'minecraft-snapshot', check JSON version file for correct filename
# 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" == "release" ]] || [[ "$target" == "snapshot" ]]; then
if [[ "$target" =~ ^minecraft ]]; then
if [[ "$target" == "minecraft" ]]; then
local versions_target="release"
elif [[ "$target" == "minecraft-snapshot" ]]; then
local versions_target="snapshot"
fi
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" "sed -n '/"latest"/,/}/p' $versions_file | grep $target | egrep -o '([0-9]+\.?)+|([0-9]+[a-zA-Z])+'")
local latest_version=$(as_user "$SETTINGS_USERNAME" "sed -n '/"latest"/,/}/p' $versions_file | grep $versions_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"

Expand Down
2 changes: 1 addition & 1 deletion installers/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function update_msm() {
# Updates rest of MSM using init script updater
function setup_jargroup() {
install_log "Setup default jar groups"
sudo /etc/init.d/msm jargroup create minecraft release
sudo /etc/init.d/msm jargroup create minecraft minecraft
}

function install_complete() {
Expand Down