Merge pull request #365 from pflueg/fix-download-vanilla-server

Fix download vanilla server
This commit is contained in:
Alexander Savchuk 2018-10-04 23:16:43 +13:00 committed by GitHub
commit e790b9de3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 15 deletions

View File

@ -1110,13 +1110,13 @@ jargroup_getlatest() {
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" "egrep -o "\""(\{[^}]*\\"\"type\\"\"\:\\"\"${versions_target}\\"\"[^}]*\})"\"" $versions_file | egrep -o -m1 'https\\:\\/\\/launchermeta\\.mojang\\.com[^\"]*'")
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_version=$(as_user "$SETTINGS_USERNAME" "echo ${latest_package_url##*/} | sed s/.json//")
if [[ -n "$latest_package_url" ]]; then
local package_file="/tmp/minecraft_package.json"
as_user "$SETTINGS_USERNAME" "wget --quiet $wget_opts --no-check-certificate -O '$package_file' '$latest_package_url'"
local jar_url=$(as_user "$SETTINGS_USERNAME" "egrep -o -m1 'https.*server\\.jar' $package_file")
local jar_url=$(as_user "$SETTINGS_USERNAME" "cat $package_file | jq -r '.downloads.server.url'")
fi
fi
@ -1423,7 +1423,7 @@ server_start() {
if [[ -f "${SERVER_PATH[$1]}"/eula.txt ]]; then
if ! grep -q -i 'eula=true' "${SERVER_PATH[$1]}"/eula.txt; then
echo " Could not start the server as you first need to agree to an EULA. See eula.txt for more info."
echo " Could not start the server as you first need to agree to an EULA. See eula.txt for more info (${SERVER_PATH[$1]}/eula.txt)."
return
fi
fi

View File

@ -9,7 +9,7 @@ function update_system_packages() {
function install_dependencies() {
install_log "Installing required packages"
sudo pacman --noconfirm -S screen rsync zip wget || install_error "Couldn't install dependencies"
sudo pacman --noconfirm -S screen rsync zip wget jq || install_error "Couldn't install dependencies"
}
function enable_init() {

View File

@ -1,3 +1,5 @@
#!/bin/bash
UPDATE_URL="https://raw.githubusercontent.com/msmhq/msm/master"
wget -q ${UPDATE_URL}/installers/common.sh -O /tmp/msmcommon.sh
source /tmp/msmcommon.sh && rm -f /tmp/msmcommon.sh
@ -10,7 +12,7 @@ function update_system_packages() {
function install_dependencies() {
install_log "Installing required packages"
sudo apt-get install screen rsync zip || install_error "Couldn't install dependencies"
sudo apt-get install screen rsync zip jq || install_error "Couldn't install dependencies"
}
function enable_init() {

View File

@ -9,7 +9,7 @@ function update_system_packages() {
function install_dependencies() {
install_log "Installing required packages"
sudo yum install screen rsync zip java || install_error "Couldn't install dependencies"
sudo yum install screen rsync zip java jq || install_error "Couldn't install dependencies"
}
function enable_init() {