SERVER_JAR="${MC_SERVER_DIR}/minecraft_server.jar"
MC_SERVER_CUR_LINK_BASE="minecraft_server.current.jar"
+MC_USER="minecraft"
+MC_GROUP="users"
+
VERSION_MANIFEST='https://launchermeta.mojang.com/mc/game/version_manifest.json'
CURRENT_VERSION=
UPSTREAM_VERSION=
DOWNLOAD_URL=
+TARGET_JAR=
DESCRIPTION=$( cat <<-EOF
Update Micraft server .jar file.
info "Checking preferences ..."
local all_ok="y"
+ check_for_root
+
local -a tools=('curl' 'jq')
local tool=
local folder=
exit 7
fi
debug "Download URL: '${CYAN}${DOWNLOAD_URL}${NORMAL}'."
+ TARGET_JAR="minecraft_server.${UPSTREAM_VERSION}.jar"
+
+}
+
+#------------------------------------------------------------------------------
+do_download() {
+
+ info "Downloading upstream server.jar => '${CYAN}${TARGET_JAR}${NORMAL}' ..."
+
+ if [[ -f "${TARGET_JAR}" ]] ; then
+ warn "Server jar file '${YELLOW}${MC_BACKUP_DIR}/${TARGET_JAR}${NORMAL}' already exists."
+ return
+ fi
+
+ local cmd="curl -o \"${TARGET_JAR}\" -s \"${DOWNLOAD_URL}\""
+ if [[ "${SIMULATE}" == "y" ]] ; then
+ info "Executing: ${cmd}"
+ else
+ debug "Executing: ${cmd}"
+ eval ${cmd}
+ fi
+ CHOWN "${MC_USER}:${MC_GROUP}" "${TARGET_JAR}"
}
info "Version '${GREEN}${UPSTREAM_VERSION}${NORMAL}' not changed, no update."
exit 0
fi
+ do_download
}