Browse Source

code tidy then

pull/1477/head
Daniel Gibbs 8 years ago
parent
commit
40c36615cd
  1. 2
      lgsm/functions/check.sh
  2. 2
      lgsm/functions/check_system_dir.sh
  3. 4
      lgsm/functions/check_tmuxception.sh
  4. 2
      lgsm/functions/command_dev_detect_deps.sh
  5. 2
      lgsm/functions/command_dev_detect_glibc.sh
  6. 2
      lgsm/functions/command_start.sh
  7. 6
      lgsm/functions/core_functions.sh
  8. 1
      lgsm/functions/info_config.sh
  9. 4
      lgsm/functions/install_gslt.sh
  10. 4
      lgsm/functions/mods_core.sh
  11. 12
      linuxgsm.sh

2
lgsm/functions/check.sh

@ -13,7 +13,7 @@ local commandname="CHECK"
check_root.sh
check_tmuxception.sh
if [ "${function_selfname}" != "command_monitor.sh" ];then
if [ "${function_selfname}" != "command_monitor.sh" ]; then
check_permissions.sh
fi

2
lgsm/functions/check_system_dir.sh

@ -7,7 +7,7 @@
local commandname="CHECK"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
if [ "${function_selfname}" != "command_validate.sh" ];then
if [ "${function_selfname}" != "command_validate.sh" ]; then
checkdir="${serverfiles}"
else
checkdir="${systemdir}"

4
lgsm/functions/check_tmuxception.sh

@ -8,7 +8,7 @@
local commandname="check"
fn_check_is_in_tmux(){
if [ -n "${TMUX}" ];then
if [ -n "${TMUX}" ]; then
fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session."
fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a tmux session."
fn_print_information_nl "LinuxGSM creates a tmux session when starting the server."
@ -18,7 +18,7 @@ fn_check_is_in_tmux(){
fi
}
fn_check_is_in_screen(){
if [ -n "${STY}" ];then
if [ -n "${STY}" ]; then
fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session."
fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a screen session."
fn_print_information_nl "LinuxGSM creates a tmux session when starting the server."

2
lgsm/functions/command_dev_detect_deps.sh

@ -23,7 +23,7 @@ fi
files=$(find ${filesdir} | wc -l)
find "${filesdir}" -type f -print0 |
while IFS= read -r -d $'\0' line; do
if [ "${readelf}" == "eu-readelf" ];then
if [ "${readelf}" == "eu-readelf" ]; then
${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $4 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
else
${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $5 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"

2
lgsm/functions/command_dev_detect_glibc.sh

@ -32,7 +32,7 @@ files=$(find ${serverfiles} | wc -l)
find ${serverfiles} -type f -print0 |
while IFS= read -r -d $'\0' line; do
glibcversion=$(objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" |grep -v GLIBCXX|sort|uniq|sort -r --version-sort| head -n 1)
if [ "${glibcversion}" ];then
if [ "${glibcversion}" ]; then
echo "${glibcversion}: ${line}" >>"${tmpdir}/detect_glibc_files.tmp"
fi
objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"

2
lgsm/functions/command_start.sh

@ -37,7 +37,7 @@ fn_start_teamspeak3(){
# Create lockfile
date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
if [ "${ts3serverpass}" == "1" ];then
if [ "${ts3serverpass}" == "1" ]; then
./ts3server_startscript.sh start serveradmin_password="${newpassword}" inifile="${servercfgfullpath}" > /dev/null 2>&1
else
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1

6
lgsm/functions/core_functions.sh

@ -9,7 +9,7 @@
core_dl.sh(){
functionfile="${FUNCNAME}"
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ];then
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
else
fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
@ -18,7 +18,7 @@ fi
core_messages.sh(){
functionfile="${FUNCNAME}"
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ];then
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
else
fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
@ -27,7 +27,7 @@ fi
core_legacy.sh(){
functionfile="${FUNCNAME}"
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ];then
if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
else
fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"

1
lgsm/functions/info_config.sh

@ -21,7 +21,6 @@ fn_info_config_avalanche(){
maxplayers="${zero}"
port="${zero}"
else
servername=$(grep "Name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]')

4
lgsm/functions/install_gslt.sh

@ -26,7 +26,7 @@ fn_script_log_info "Get more info and a token here:"
fn_script_log_info "https://gameservermanagers.com/gslt"
echo ""
if [ -z "${autoinstall}" ]; then
if [ "${gamename}" != "Tower Unite" ];then
if [ "${gamename}" != "Tower Unite" ]; then
echo "Enter token below (Can be blank)."
echo -n "GSLT TOKEN: "
read token
@ -34,7 +34,7 @@ if [ -z "${autoinstall}" ]; then
fi
fi
sleep 1
if [ "${gamename}" == "Tower Unite" ];then
if [ "${gamename}" == "Tower Unite" ]; then
echo "The GSLT can be changed by editing ${servercfg}."
fn_script_log_info "The GSLT can be changed by editing ${servercfg}."
else

4
lgsm/functions/mods_core.sh

@ -230,7 +230,7 @@ fn_mods_installed_list(){
# Increment line check
((installedmodsline++))
done
if [ -n "${installedmodscount}" ] ;then
if [ -n "${installedmodscount}" ] ; then
fn_script_log_info "${installedmodscount} addons/mods are currently installed"
fi
}
@ -345,7 +345,7 @@ fn_mod_compatible_test(){
# Create mods files and directories if it doesn't exist
fn_create_mods_dir(){
# Create lgsm data modsdir
if [ ! -d "${modsdir}" ];then
if [ ! -d "${modsdir}" ]; then
echo -en "creating LinuxGSM mods data directory ${modsdir}..."
mkdir -p "${modsdir}"
exitcode=$?

12
linuxgsm.sh

@ -281,7 +281,7 @@ if [ "${shortname}" == "core" ]; then
fi
fi
if [ ! -f "${serverlist}" ];then
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
@ -318,11 +318,11 @@ else
# 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/${servername}/_default.cfg" ];then
if [ ! -f "${configdirdefault}/config-lgsm/${servername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${servername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${servername}" "_default.cfg" "${configdirdefault}/config-lgsm/${servername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
if [ ! -f "${configdirserver}/_default.cfg" ];then
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -ne " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${servername}/_default.cfg" "${configdirserver}/_default.cfg"
@ -350,21 +350,21 @@ else
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
if [ ! -f "${configdirserver}/common.cfg" ];then
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
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
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
getopt=$1

Loading…
Cancel
Save