|
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
|
|
|
set -x
|
|
set -x
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-version="180908"
|
|
|
|
|
|
|
+version="181007"
|
|
|
shortname="core"
|
|
shortname="core"
|
|
|
gameservername="core"
|
|
gameservername="core"
|
|
|
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
@@ -38,6 +38,7 @@ tmpdir="${lgsmdir}/tmp"
|
|
|
configdir="${lgsmdir}/config-lgsm"
|
|
configdir="${lgsmdir}/config-lgsm"
|
|
|
configdirserver="${configdir}/${gameservername}"
|
|
configdirserver="${configdir}/${gameservername}"
|
|
|
configdirdefault="${lgsmdir}/config-default"
|
|
configdirdefault="${lgsmdir}/config-default"
|
|
|
|
|
+userinput="${1}"
|
|
|
|
|
|
|
|
## GitHub Branch Select
|
|
## GitHub Branch Select
|
|
|
# Allows for the use of different function files
|
|
# Allows for the use of different function files
|
|
@@ -254,9 +255,14 @@ fn_install_file(){
|
|
|
exit
|
|
exit
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-# Prevent from running this script as root.
|
|
|
|
|
|
|
+# Prevent LinuxGSM from running as root. Except if doing a dependency install.
|
|
|
if [ "$(whoami)" == "root" ]; then
|
|
if [ "$(whoami)" == "root" ]; then
|
|
|
- if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
|
|
|
|
|
|
|
+ if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then
|
|
|
|
|
+ if [ "${shortname}" == "core" ]; then
|
|
|
|
|
+ echo "[ FAIL ] Do NOT run this script as root!"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ fi
|
|
|
|
|
+ elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
|
|
|
echo "[ FAIL ] Do NOT run this script as root!"
|
|
echo "[ FAIL ] Do NOT run this script as root!"
|
|
|
exit 1
|
|
exit 1
|
|
|
else
|
|
else
|
|
@@ -267,7 +273,6 @@ fi
|
|
|
|
|
|
|
|
# LinuxGSM installer mode
|
|
# LinuxGSM installer mode
|
|
|
if [ "${shortname}" == "core" ]; then
|
|
if [ "${shortname}" == "core" ]; then
|
|
|
- userinput=$1
|
|
|
|
|
datadir="${tmpdir}/data"
|
|
datadir="${tmpdir}/data"
|
|
|
serverlist="${datadir}/serverlist.csv"
|
|
serverlist="${datadir}/serverlist.csv"
|
|
|
|
|
|
|
@@ -310,29 +315,16 @@ if [ "${shortname}" == "core" ]; then
|
|
|
# LinuxGSM Server Mode
|
|
# LinuxGSM Server Mode
|
|
|
else
|
|
else
|
|
|
core_functions.sh
|
|
core_functions.sh
|
|
|
-
|
|
|
|
|
- # Load LinuxGSM configs
|
|
|
|
|
- # These are required to get all the default variables for the specific server.
|
|
|
|
|
- # Load the default config. If missing download it. If changed reload it.
|
|
|
|
|
- if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
|
|
|
|
|
- mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
|
|
|
|
|
- fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
- fi
|
|
|
|
|
- if [ ! -f "${configdirserver}/_default.cfg" ]; then
|
|
|
|
|
- mkdir -p "${configdirserver}"
|
|
|
|
|
- echo -ne " copying _default.cfg...\c"
|
|
|
|
|
- cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
|
|
|
|
- exitcode=$?
|
|
|
|
|
- if [ ${exitcode} -ne 0 ]; then
|
|
|
|
|
- echo -e "FAIL"
|
|
|
|
|
- exit 1
|
|
|
|
|
- else
|
|
|
|
|
- echo -e "OK"
|
|
|
|
|
|
|
+ if [ "${shortname}" != "core-dep" ]; then
|
|
|
|
|
+ # Load LinuxGSM configs
|
|
|
|
|
+ # These are required to get all the default variables for the specific server.
|
|
|
|
|
+ # Load the default config. If missing download it. If changed reload it.
|
|
|
|
|
+ if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
|
|
|
|
|
+ mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
|
|
|
|
|
+ fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
fi
|
|
fi
|
|
|
- else
|
|
|
|
|
- function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
|
|
|
|
|
- if [ "${function_file_diff}" != "" ]; then
|
|
|
|
|
- fn_print_warn_nl "_default.cfg has been altered. reloading config."
|
|
|
|
|
|
|
+ if [ ! -f "${configdirserver}/_default.cfg" ]; then
|
|
|
|
|
+ mkdir -p "${configdirserver}"
|
|
|
echo -ne " copying _default.cfg...\c"
|
|
echo -ne " copying _default.cfg...\c"
|
|
|
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
|
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
|
|
exitcode=$?
|
|
exitcode=$?
|
|
@@ -342,27 +334,41 @@ else
|
|
|
else
|
|
else
|
|
|
echo -e "OK"
|
|
echo -e "OK"
|
|
|
fi
|
|
fi
|
|
|
|
|
+ else
|
|
|
|
|
+ function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
|
|
|
|
|
+ if [ "${function_file_diff}" != "" ]; then
|
|
|
|
|
+ fn_print_warn_nl "_default.cfg has been altered. reloading config."
|
|
|
|
|
+ echo -ne " copying _default.cfg...\c"
|
|
|
|
|
+ cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
|
|
|
|
|
+ exitcode=$?
|
|
|
|
|
+ if [ ${exitcode} -ne 0 ]; then
|
|
|
|
|
+ echo -e "FAIL"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ else
|
|
|
|
|
+ echo -e "OK"
|
|
|
|
|
+ fi
|
|
|
|
|
+ fi
|
|
|
|
|
+ fi
|
|
|
|
|
+ source "${configdirserver}/_default.cfg"
|
|
|
|
|
+ # Load the common.cfg config. If missing download it
|
|
|
|
|
+ if [ ! -f "${configdirserver}/common.cfg" ]; then
|
|
|
|
|
+ fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
+ source "${configdirserver}/common.cfg"
|
|
|
|
|
+ else
|
|
|
|
|
+ source "${configdirserver}/common.cfg"
|
|
|
|
|
+ fi
|
|
|
|
|
+ # Load the instance.cfg config. If missing download it
|
|
|
|
|
+ if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
|
|
|
|
|
+ fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
+ source "${configdirserver}/${servicename}.cfg"
|
|
|
|
|
+ else
|
|
|
|
|
+ source "${configdirserver}/${servicename}.cfg"
|
|
|
fi
|
|
fi
|
|
|
- fi
|
|
|
|
|
- source "${configdirserver}/_default.cfg"
|
|
|
|
|
- # Load the common.cfg config. If missing download it
|
|
|
|
|
- if [ ! -f "${configdirserver}/common.cfg" ]; then
|
|
|
|
|
- fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
- source "${configdirserver}/common.cfg"
|
|
|
|
|
- else
|
|
|
|
|
- source "${configdirserver}/common.cfg"
|
|
|
|
|
- fi
|
|
|
|
|
- # Load the instance.cfg config. If missing download it
|
|
|
|
|
- if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
|
|
|
|
|
- fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
- source "${configdirserver}/${servicename}.cfg"
|
|
|
|
|
- else
|
|
|
|
|
- source "${configdirserver}/${servicename}.cfg"
|
|
|
|
|
- fi
|
|
|
|
|
|
|
|
|
|
- # Load the linuxgsm.sh in to tmpdir. If missing download it
|
|
|
|
|
- if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
|
|
|
|
|
- fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
|
|
+ # Load the linuxgsm.sh in to tmpdir. If missing download it
|
|
|
|
|
+ if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
|
|
|
|
|
+ fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
|
|
|
|
|
+ fi
|
|
|
fi
|
|
fi
|
|
|
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off
|
|
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off
|
|
|
fn_ansi_loader
|
|
fn_ansi_loader
|
|
@@ -371,4 +377,4 @@ else
|
|
|
getopt=$1
|
|
getopt=$1
|
|
|
core_getopt.sh
|
|
core_getopt.sh
|
|
|
fi
|
|
fi
|
|
|
-fi
|
|
|
|
|
|
|
+fi
|