diff --git a/.travis.yml b/.travis.yml index c5bfa204d..deadbfe64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ addons: - ca-certificates - binutils - bc + - jq - tmux - lib32gcc1 - libstdc++6 diff --git a/lgsm/config-default/config-lgsm/mcserver/_default.cfg b/lgsm/config-default/config-lgsm/mcserver/_default.cfg index a3f973da4..92830934b 100644 --- a/lgsm/config-default/config-lgsm/mcserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mcserver/_default.cfg @@ -89,7 +89,7 @@ engine="lwjgl2" ## Server Specific Directories systemdir="${serverfiles}" executabledir="${serverfiles}" -executable="java -Xmx${javaram}M -jar ${serverfiles}/minecraft_server.jar nogui" +executable="java -Xmx${javaram}M -jar ${serverfiles}/minecraft_server.jar" servercfg="server.properties" servercfgdefault="server.properties" servercfgdir="${serverfiles}" diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index de321b2fb..55085abfb 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -107,6 +107,8 @@ fn_deps_detector(){ depstatus=0 deptocheck="${javaversion}" unset javacheck + elif [ "${deptocheck}" == "jq" ]&&[ "${distroversion}" == "6" ]; then + jqstatus=1 elif [ "${deptocheck}" == "mono-complete" ]; then if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then # Mono >= 5.0.0 already installed @@ -182,6 +184,10 @@ fn_found_missing_deps(){ if [ -n "${monostatus}" ]; then fn_install_mono_repo fi + if [ -n "${jqstatus}" ]; then + fn_print_warning_nl "jq is not available in the ${distroname} repository" + echo " * https://github.com/GameServerManagers/LinuxGSM/wiki/jq" + fi sudo -v > /dev/null 2>&1 if [ $? -eq 0 ]; then fn_print_information_nl "Automatically installing missing dependencies." @@ -268,7 +274,7 @@ fn_deps_build_debian(){ array_deps_missing=() ## LinuxGSM requirements - array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc ) + array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc jq ) # All servers except ts3 require tmux if [ "${shortname}" != "ts3" ]; then @@ -373,13 +379,13 @@ fn_deps_build_redhat(){ # LinuxGSM requirements ## CentOS 6 if [ "${distroversion}" == "6" ]; then - array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip binutils bc ) + array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip binutils bc jq ) elif [ "${distroid}" == "fedora" ]; then - array_deps_required=( curl wget util-linux python2 file gzip bzip2 unzip binutils bc ) + array_deps_required=( curl wget util-linux python2 file gzip bzip2 unzip binutils bc jq ) elif [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then - array_deps_required=( curl wget util-linux python27 file gzip bzip2 unzip binutils bc ) + array_deps_required=( curl wget util-linux python27 file gzip bzip2 unzip binutils bc jq ) else - array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc ) + array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc jq ) fi # All servers except ts3 require tmux diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 88ee6cebc..c02fa932b 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -9,11 +9,13 @@ local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl(){ - fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar" + latestmcbuildurl=$(${curlpath} -s $(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.versions[0] | .url') | jq -r '.downloads.server.url') + fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "minecraft_server.${availablebuild}.jar" echo -e "copying to ${serverfiles}...\c" fn_script_log "Copying to ${serverfiles}" cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${serverfiles}/minecraft_server.jar" local exitcode=$? + chmod u+x "${serverfiles}/minecraft_server.jar" if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl else @@ -69,7 +71,7 @@ fn_update_currentbuild(){ fn_update_availablebuild(){ # Gets latest build info. - availablebuild=$(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | sed -e 's/^.*"release":"\([^"]*\)".*$/\1/') + availablebuild=$(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release') # Checks if availablebuild variable has been set if [ -z "${availablebuild}" ]; then fn_print_fail "Checking for update: mojang.com"