Browse Source

Merge pull request #1054 from GameServerManagers/development

Development
pull/1077/head
Daniel Gibbs 9 years ago
committed by GitHub
parent
commit
d10c62915d
  1. 45
      lgsm/functions/check_deps.sh
  2. 5
      lgsm/functions/command_dev_detect_glibc.sh
  3. 53
      lgsm/functions/command_dev_detect_ldd.sh
  4. 5
      lgsm/functions/core_functions.sh
  5. 16
      lgsm/functions/core_getopt.sh
  6. 2
      lgsm/functions/install_server_files.sh

45
lgsm/functions/check_deps.sh

@ -6,28 +6,37 @@
local commandname="CHECK"
fn_deps_detector(){
# Checks if dependency is missing
if [ -n "$(command -v dpkg-query)" ]; then
if [ "${tmuxcheck}" == "1" ]; then
# Added for users compiling tmux from source to bypass check.
depstatus=0
deptocheck="tmux"
unset tmuxcheck
elif [ "${javacheck}" == "1" ]; then
# Added for users using Oracle JRE to bypass check.
depstatus=0
deptocheck="${javaversion}"
unset javacheck
elif [ -n "$(command -v apt-get)" ]; then
dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed$'
depstatus=$?
elif [ -n "$(command -v yum)" ]; then
yum -q list installed ${deptocheck} > /dev/null 2>&1
depstatus=$?
fi
if [ "${depstatus}" == "0" ]; then
# if dependency is found
missingdep=0
if [ "${function_selfname}" == "command_install.sh" ]; then
if [ "${tmuxcheck}" == "1" ]; then
# Added for users compiling tmux from source to bypass rpm check
echo -e "${green}tmux${default}"
unset tmuxcheck
fi
echo -e "${green}${deptocheck}${default}"
sleep 0.5
fi
else
# if missing dependency is found
# if dependency is not found
missingdep=1
if [ "${function_selfname}" == "command_install.sh" ]; then
echo -e "${red}${deptocheck}${default}"
@ -141,9 +150,9 @@ if [ -n "$(command -v dpkg-query)" ]; then
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip )
# All servers except ts3 require tmux
if [ "${executable}" != "./ts3server_startscript.sh" ]; then
if [ "${gamename}" != "TeamSpeak 3" ]; then
if [ "$(command -v tmux)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
tmuxcheck=1 # Added for users compiling tmux from source to bypass rpm check
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
else
array_deps_required+=( tmux )
fi
@ -181,7 +190,12 @@ if [ -n "$(command -v dpkg-query)" ]; then
array_deps_required+=( libncurses5:i386 )
# Project Zomboid and Minecraft
elif [ "${engine}" == "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
array_deps_required+=( default-jdk )
javaversion=$(java -version 2>&1 | grep "version")
if [ -n "${javaversion}" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
else
array_deps_required+=( default-jre )
fi
# GoldenEye: Source
elif [ "${gamename}" == "GoldenEye: Source" ]; then
array_deps_required+=( zlib1g:i386 )
@ -213,9 +227,9 @@ elif [ -n "$(command -v yum)" ]; then
fi
# All servers except ts3 require tmux
if [ "${executable}" != "./ts3server_startscript.sh" ]; then
if [ "${gamename}" != "TeamSpeak 3" ]; then
if [ "$(command -v tmux)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
tmuxcheck=1 # Added for users compiling tmux from source to bypass rpm check
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
else
array_deps_required+=( tmux )
fi
@ -242,7 +256,12 @@ elif [ -n "$(command -v yum)" ]; then
array_deps_required+=( libcurl.i686 )
# Project Zomboid and Minecraft
elif [ "${engine}" == "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
array_deps_required+=( java-1.8.0-openjdk )
javaversion=$(java -version 2>&1 | grep "version")
if [ -n "${javaversion}" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
else
array_deps_required+=( java-1.8.0-openjdk )
fi
# GoldenEye: Source
elif [ "${gamename}" == "GoldenEye: Source" ]; then
array_deps_required+=( zlib.i686 )

5
lgsm/functions/command_dev_detect_glibc.sh

@ -22,10 +22,13 @@ elif [ -f "${filesdir}" ]; then
fi
echo ""
files=$(find ${filesdir} | wc -l)
find ${filesdir} -type f -print0 |
while IFS= read -r -d $'\0' line; do
objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${lgsmdir}/tmp/detect_glibc.tmp"
echo -n "$i / $files" $'\r'
((i++))
done
echo ""
cat "${lgsmdir}/tmp/detect_glibc.tmp"|sort|uniq|sort -r --version-sort
rm "${lgsmdir}/tmp/detect_glibc.tmp"

53
lgsm/functions/command_dev_detect_ldd.sh

@ -0,0 +1,53 @@
#!/bin/bash
# command_dev_detect_ldd.sh function
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
# Description: Automatically detects required deps using ldd.
# Can check a file or directory recursively.
echo "================================="
echo "Shared Object dependencies Checker"
echo "================================="
if [ -z "${filesdir}" ]; then
dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
fi
if [ -d "${filesdir}" ]; then
echo "Checking directory: "
echo "${filesdir}"
elif [ -f "${filesdir}" ]; then
echo "Checking file: "
echo "${filesdir}"
fi
echo ""
files=$(find ${filesdir} | wc -l)
find ${filesdir} -type f -print0 |
while IFS= read -r -d $'\0' line; do
#ldd -v $line 2>/dev/null|grep "=>" >>"${lgsmdir}/tmp/detect_ldd.tmp"
if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable")" ]; then
echo "$line" >> "${lgsmdir}/tmp/detect_ldd.tmp"
ldd $line 2>/dev/null |grep -v "not a dynamic executable" >> "${lgsmdir}/tmp/detect_ldd.tmp"
if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found")" ]; then
echo "$line" >> "${lgsmdir}/tmp/detect_ldd_not_found.tmp"
ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found" >> "${lgsmdir}/tmp/detect_ldd_not_found.tmp"
fi
fi
echo -n "$i / $files" $'\r'
((i++))
done
echo ""
echo ""
echo "All"
echo "================================="
cat "${lgsmdir}/tmp/detect_ldd.tmp"
echo ""
echo "Not Found"
echo "================================="
cat "${lgsmdir}/tmp/detect_ldd_not_found.tmp"
rm "${lgsmdir}/tmp/detect_ldd.tmp"
rm "${lgsmdir}/tmp/detect_ldd_not_found.tmp"

5
lgsm/functions/core_functions.sh

@ -283,6 +283,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
command_dev_detect_ldd.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
# Fix
fix.sh(){

16
lgsm/functions/core_getopt.sh

@ -45,6 +45,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -107,6 +109,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -168,6 +172,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -224,6 +230,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -288,6 +296,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
fd|fastdl)
command_fastdl.sh;;
*)
@ -355,6 +365,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"
@ -423,6 +435,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
mc|map-compressor)
compress_unreal2_maps.sh;;
*)
@ -493,6 +507,8 @@ case "${getopt}" in
command_dev_detect_deps.sh;;
dg|detect-glibc)
command_dev_detect_glibc.sh;;
dl|detect-ldd)
command_dev_detect_ldd.sh;;
*)
if [ -n "${getopt}" ]; then
echo -e "${red}Unknown command${default}: $0 ${getopt}"

2
lgsm/functions/install_server_files.sh

@ -22,7 +22,7 @@ fn_install_server_files(){
elif [ "${gamename}" == "Unreal Tournament" ]; then
fileurl="http://files.gameservermanagers.com/UnrealTournament/UnrealTournament-Server-XAN-3045522-Linux.zip"; filedir="${lgsmdir}/tmp"; filename="UnrealTournament-Server-XAN-3045522-Linux.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="553fed5645a9fc623e92563049bf79f6"
elif [ "${gamename}" == "GoldenEye: Source" ]; then
fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="254533d4643ad2fe6f1f3ecc4f6b5e5f"
fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="ea227a150300abe346e757380325f84c"
fi
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
fn_dl_extract "${filedir}" "${filename}" "${filesdir}"

Loading…
Cancel
Save