--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+BASE_NAME="$( basename ${0} )"
+MY_REAL_NAME=$( readlink -f $0 )
+BIN_DIR=$( dirname "${MY_REAL_NAME}" )
+BASE_DIR=$( dirname "${BIN_DIR}" )
+LIB_DIR="${BASE_DIR}/lib"
+CONF_DIR="${BASE_DIR}/etc"
+
+if [[ -f "${LIB_DIR}/functions.rc" ]] ; then
+ . "${LIB_DIR}/functions.rc"
+else
+ echo "Bash resource file '${LIB_DIR}/functions.rc' not found" >&2
+ exit 5
+fi
+
+
+MC_ROOT_DIR="/home/minecraft"
+MC_BACKUP_DIR="${MC_ROOT_DIR}/backup"
+MC_SERVER_DIR="${MC_ROOT_DIR}/server"
+SERVER_JAR="${MC_SERVER_DIR}/minecraft_server.jar"
+
+VERSION_MANIFEST='https://launchermeta.mojang.com/mc/game/version_manifest.json'
+
+CURRENT_VERSION=
+UPSTREAM_VERSION=
+
+DESCRIPTION=$( cat <<-EOF
+ Update Micraft server .jar file.
+
+ EOF
+)
+
+#------------------------------------------------------------------------------
+usage() {
+ cat <<-EOF
+ Usage: ${BASE_NAME} [Common Options]
+ ${BASE_NAME} [-h|--help]
+ ${BASE_NAME} [-V|--version]
+
+ Common Options:
+ ${STD_USAGE_MSG}
+ EOF
+
+}
+
+#------------------------------------------------------------------------------
+get_options() {
+
+ local tmp=
+ local base_dir=
+
+ set +e
+ tmp=$( getopt -o ${STD_SHORT_OPTIONS} --long ${STD_LONG_OPTIONS} -n "${BASE_NAME}" -- "$@" )
+ if [[ $? != 0 ]] ; then
+ echo "" >&2
+ usage >&2
+ exit 1
+ fi
+ set -e
+
+ # Note the quotes around `$TEMP': they are essential!
+ eval set -- "${tmp}"
+ eval_common_options "$@"
+ if [[ "${DEBUG}" == 'y' ]] ; then
+ declare -p REMAINING_OPTS
+ declare -p REMAINING_ARGS
+ fi
+
+ if [[ "${#REMAINING_OPTS[@]}" -gt 0 ]] ; then
+ error "Unknown options: ${REMAINING_OPTS[*]}"
+ echo >&2
+ usage >&2
+ exit 2
+ fi
+
+ if [[ "${#REMAINING_ARGS[@]}" -gt 0 ]] ; then
+ error "Invalid arguments: ${REMAINING_ARGS[*]}"
+ echo >&2
+ usage >&2
+ exit 2
+ fi
+
+ check_for_root
+
+ LOGFILE="/var/log/${BASE_NAME}.log"
+
+}
+
+#------------------------------------------------------------------------------
+check_preferences() {
+
+ info "Checking preferences ..."
+ local all_ok="y"
+
+ local -a tools=('curl' 'jq')
+ local tool=
+ local folder=
+
+ for tool in "${tools[@]}" ; do
+ debug "Checking for '${CYAN}${tool}${NORMAL}' ..."
+ if type -p ${tool} >/dev/null ; then
+ :
+ else
+ all_ok="n"
+ error "Did not found '${RED}${tool}${NORMAL}'. Maybe not installed?"
+ fi
+ done
+
+ for folder in "${MC_BACKUP_DIR}" "${MC_SERVER_DIR}" ; do
+ debug "Checking for directory '${folder}' ..."
+ if [[ ! -d "${folder}" ]]; then
+ all_ok="n"
+ error "Did not found directory '${RED}${folder}${NORMAL}'."
+ fi
+ done
+
+ if [[ "${all_ok}" != "y" ]] ; then
+ exit 5
+ fi
+
+}
+
+#------------------------------------------------------------------------------
+main() {
+
+ get_options "$@"
+ umask 0022
+
+ check_preferences
+}
+
+main "$@"
+
+exit 0
+
+# vim: et list
+++ /dev/null
-#!/bin/bash
-
-set -e
-set -u
-
-BASE_NAME="$( basename ${0} )"
-MY_REAL_NAME=$( readlink -f $0 )
-BIN_DIR=$( dirname "${MY_REAL_NAME}" )
-BASE_DIR=$( dirname "${BIN_DIR}" )
-LIB_DIR="${BASE_DIR}/lib"
-CONF_DIR="${BASE_DIR}/etc"
-
-if [[ -f "${LIB_DIR}/functions.rc" ]] ; then
- . "${LIB_DIR}/functions.rc"
-else
- echo "Bash resource file '${LIB_DIR}/functions.rc' not found" >&2
- exit 5
-fi
-
-
-MC_ROOT_DIR="/home/minecraft"
-MC_BACKUP_DIR="${MC_ROOT_DIR}/backup"
-MC_SERVER_DIR="${MC_ROOT_DIR}/server"
-SERVER_JAR="${MC_SERVER_DIR}/minecraft_server.jar"
-
-VERSION_MANIFEST='https://launchermeta.mojang.com/mc/game/version_manifest.json'
-
-CURRENT_VERSION=
-UPSTREAM_VERSION=
-
-DESCRIPTION=$( cat <<-EOF
- Update Micraft server .jar file.
-
- EOF
-
-#------------------------------------------------------------------------------
-usage() {
- cat <<-EOF
- Usage: ${BASE_NAME} [Common Options]
- ${BASE_NAME} [-h|--help]
- ${BASE_NAME} [-V|--version]
-
- Common Options:
- ${STD_USAGE_MSG}
- EOF
-
-}
-
-#------------------------------------------------------------------------------
-get_options() {
-
- local tmp=
- local base_dir=
-
- set +e
- tmp=$( getopt -o ${STD_SHORT_OPTIONS} --long ${STD_LONG_OPTIONS} -n "${BASE_NAME}" -- "$@" )
- if [[ $? != 0 ]] ; then
- echo "" >&2
- usage >&2
- exit 1
- fi
- set -e
-
- # Note the quotes around `$TEMP': they are essential!
- eval set -- "${tmp}"
- eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
- declare -p REMAINING_OPTS
- declare -p REMAINING_ARGS
- fi
-
- if [[ "${#REMAINING_OPTS[@]}" -gt 0 ]] ; then
- error "Unknown options: ${REMAINING_OPTS[*]}"
- echo >&2
- usage >&2
- exit 2
- fi
-
- if [[ "${#REMAINING_ARGS[@]}" -gt 0 ]] ; then
- error "Invalid arguments: ${REMAINING_ARGS[*]}"
- echo >&2
- usage >&2
- exit 2
- fi
-
- check_for_root
-
- LOGFILE="/var/log/${BASE_NAME}.log"
-
-}
-
-#------------------------------------------------------------------------------
-check_preferences() {
-
- info "Checking preferences ..."
- local all_ok="y"
-
- local -a tools=('curl' 'jq')
- local tool=
- local folder=
-
- for tool in "${tools[@]}" ; do
- debug "Checking for '${CYAN}${tool}${NORMAL}' ..."
- if type -p ${tool} >/dev/null ; then
- :
- else
- all_ok="n"
- error "Did not found '${RED}${tool}${NORMAL}'. Maybe not installed?"
- fi
- done
-
- for folder in "${MC_BACKUP_DIR}" "${MC_SERVER_DIR}" ; do
- debug "Checking for directory '${folder}' ..."
- if [[ ! -d "${folder}" ]]; then
- all_ok="n"
- error "Did not found directory '${RED}${folder}${NORMAL}'."
- fi
- done
-
- if [[ "${all_ok}" != "y" ]] ; then
- exit 5
- fi
-
-}
-
-#------------------------------------------------------------------------------
-main() {
-
- get_options "$@"
- umask 0022
-
- check_preferences
-}
-
-main "$@"
-
-exit 0
-
-# vim: et list