|
@@ -35,8 +35,8 @@ fn_update_minecraft_localbuild(){
|
|
|
# Gets local build info.
|
|
# Gets local build info.
|
|
|
fn_print_dots "Checking local build: ${remotelocation}"
|
|
fn_print_dots "Checking local build: ${remotelocation}"
|
|
|
# Uses log file to gather info.
|
|
# Uses log file to gather info.
|
|
|
- # Gives time for log file to generate.
|
|
|
|
|
- if [ ! -f "${serverfiles}/logs/latest.log" ]; then
|
|
|
|
|
|
|
+ localbuild=$(grep Version "${consolelogdir}"/* 2>/dev/null | tail -1 | sed 's/.*Version //')
|
|
|
|
|
+ if [ -z "${localbuild}" ]; then
|
|
|
fn_print_error "Checking local build: ${remotelocation}"
|
|
fn_print_error "Checking local build: ${remotelocation}"
|
|
|
fn_print_error_nl "Checking local build: ${remotelocation}: no log files containing version info"
|
|
fn_print_error_nl "Checking local build: ${remotelocation}: no log files containing version info"
|
|
|
fn_print_info_nl "Checking local build: ${remotelocation}: forcing server restart"
|
|
fn_print_info_nl "Checking local build: ${remotelocation}: forcing server restart"
|
|
@@ -49,8 +49,8 @@ fn_update_minecraft_localbuild(){
|
|
|
command_start.sh
|
|
command_start.sh
|
|
|
fn_firstcommand_reset
|
|
fn_firstcommand_reset
|
|
|
totalseconds=0
|
|
totalseconds=0
|
|
|
- # Check again, allow time to generate logs.
|
|
|
|
|
- while [ ! -f "${serverfiles}/logs/latest.log" ]; do
|
|
|
|
|
|
|
+ localbuild=$(grep Version "${consolelogdir}"/* 2>/dev/null | tail -1 | sed 's/.*Version //')
|
|
|
|
|
+ while [ -z "${localbuild}" ]; do
|
|
|
sleep 1
|
|
sleep 1
|
|
|
fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}"
|
|
fn_print_info "Checking local build: ${remotelocation}: waiting for log file: ${totalseconds}"
|
|
|
if [ -v "${loopignore}" ]; then
|
|
if [ -v "${loopignore}" ]; then
|
|
@@ -58,45 +58,18 @@ fn_update_minecraft_localbuild(){
|
|
|
fn_script_log_info "Waiting for log file to generate"
|
|
fn_script_log_info "Waiting for log file to generate"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+ localbuild=$(grep Version "$(ls -tr "${consolelogdir}"/* 2>/dev/null)" | tail -1 | sed 's/.*Version //')
|
|
|
if [ "${totalseconds}" -gt "120" ]; then
|
|
if [ "${totalseconds}" -gt "120" ]; then
|
|
|
localbuild="0"
|
|
localbuild="0"
|
|
|
- fn_print_error "Checking local build: ${remotelocation}: waiting for log file: missing log file"
|
|
|
|
|
- fn_script_log_error "Missing log file"
|
|
|
|
|
- fn_script_log_error "Set localbuild to 0"
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- totalseconds=$((totalseconds + 1))
|
|
|
|
|
- done
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- if [ -z "${localbuild}" ]; then
|
|
|
|
|
- localbuild=$(grep version "${serverfiles}/logs/latest.log" | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}(-pre[0-9]+)?|([0-9]+w[0-9]+[a-z])')
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- if [ -z "${localbuild}" ]; then
|
|
|
|
|
- # Gives time for var to generate.
|
|
|
|
|
- totalseconds=0
|
|
|
|
|
- for seconds in {1..120}; do
|
|
|
|
|
- fn_print_info "Checking local build: ${remotelocation}: waiting for local build: ${totalseconds}"
|
|
|
|
|
- if [ -z "${loopignore}" ]; then
|
|
|
|
|
- loopignore=1
|
|
|
|
|
- fn_script_log_info "Waiting for local build to generate"
|
|
|
|
|
- fi
|
|
|
|
|
- localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}(-pre[0-9]+)?|([0-9]+w[0-9]+[a-z])')
|
|
|
|
|
- if [ "${localbuild}" ]||[ "${seconds}" == "120" ]; then
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ fn_print_error "Checking local build: ${remotelocation}: waiting for log file"
|
|
|
|
|
+ fn_script_log_error "Local build did not generate"
|
|
|
|
|
+ fn_script_log_error "Required log file may be missing"
|
|
|
|
|
+ fn_script_log_error "Local build set to 0"
|
|
|
fi
|
|
fi
|
|
|
- sleep 1
|
|
|
|
|
totalseconds=$((totalseconds + 1))
|
|
totalseconds=$((totalseconds + 1))
|
|
|
done
|
|
done
|
|
|
fi
|
|
fi
|
|
|
-
|
|
|
|
|
- if [ -z "${localbuild}" ]; then
|
|
|
|
|
- localbuild="0"
|
|
|
|
|
- fn_print_error "Checking local build: ${remotelocation}: waiting for local build: missing local build info"
|
|
|
|
|
- fn_script_log_error "Missing local build info"
|
|
|
|
|
- fn_script_log_error "Set localbuild to 0"
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ if [ "${localbuild}" != "0" ]; then
|
|
|
fn_print_ok "Checking local build: ${remotelocation}"
|
|
fn_print_ok "Checking local build: ${remotelocation}"
|
|
|
fn_script_log_pass "Checking local build"
|
|
fn_script_log_pass "Checking local build"
|
|
|
fi
|
|
fi
|
|
@@ -110,7 +83,7 @@ fn_update_minecraft_remotebuild(){
|
|
|
remotebuild=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.versions[0].id')
|
|
remotebuild=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.versions[0].id')
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
- if [ "${installer}" != "1" ]; then
|
|
|
|
|
|
|
+ if [ "${firstcommandname}" != "INSTALL" ]; then
|
|
|
fn_print_dots "Checking remote build: ${remotelocation}"
|
|
fn_print_dots "Checking remote build: ${remotelocation}"
|
|
|
# Checks if remotebuild variable has been set.
|
|
# Checks if remotebuild variable has been set.
|
|
|
if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
|
|
if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
|
|
@@ -197,7 +170,7 @@ fn_update_minecraft_compare(){
|
|
|
# The location where the builds are checked and downloaded.
|
|
# The location where the builds are checked and downloaded.
|
|
|
remotelocation="mojang.com"
|
|
remotelocation="mojang.com"
|
|
|
|
|
|
|
|
-if [ "${installer}" == "1" ]; then
|
|
|
|
|
|
|
+if [ "${firstcommandname}" == "INSTALL" ]; then
|
|
|
fn_update_minecraft_remotebuild
|
|
fn_update_minecraft_remotebuild
|
|
|
fn_update_minecraft_dl
|
|
fn_update_minecraft_dl
|
|
|
else
|
|
else
|