Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master' into development

pull/969/head
Daniel Gibbs 9 years ago
parent
commit
8005bbe285
  1. 2
      ARKSurvivalEvolved/arkserver
  2. 3
      Left4Dead2/l4d2server
  3. 33
      Mumble/mumbleserver
  4. 4
      lgsm/functions/alert.sh
  5. 26
      lgsm/functions/check_permissions.sh
  6. 11
      lgsm/functions/check_status.sh
  7. 17
      lgsm/functions/command_details.sh
  8. 5
      lgsm/functions/command_install.sh
  9. 22
      lgsm/functions/command_monitor.sh
  10. 3
      lgsm/functions/command_start.sh
  11. 30
      lgsm/functions/command_stop.sh
  12. 4
      lgsm/functions/command_update.sh
  13. 7
      lgsm/functions/core_dl.sh
  14. 15
      lgsm/functions/core_functions.sh
  15. 17
      lgsm/functions/core_getopt.sh
  16. 29
      lgsm/functions/info_config.sh
  17. 3
      lgsm/functions/info_glibc.sh
  18. 2
      lgsm/functions/install_server_files.sh
  19. 165
      lgsm/functions/update_mumble.sh
  20. 75
      lgsm/functions/update_ts3.sh

2
ARKSurvivalEvolved/arkserver

@ -40,7 +40,7 @@ ip="0.0.0.0"
updateonstart="off"
fn_parms(){
parms="TheIsland?listen?MultiHome=${ip}?SessionName=${servername}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?ServerAdminPassword=${rconpassword}"
parms="TheIsland?listen?MultiHome=${ip}?SessionName=${servername}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?ServerAdminPassword=${rconpassword}"
}
#### Advanced Variables ####

3
Left4Dead2/l4d2server

@ -25,9 +25,6 @@ email="[email protected]"
pushbulletalert="off"
pushbullettoken="accesstoken"
# Pushover
#Push alot
# Steam login
steamuser="anonymous"
steampass=""

33
Mumble/mumbleserver

@ -2,6 +2,7 @@
# Mumble
# Server Management Script
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
@ -9,7 +10,7 @@ if [ -f ".dev-debug" ]; then
set -x
fi
version="210516"
version="290716"
#### Variables ####
@ -25,6 +26,23 @@ email="[email protected]"
pushbulletalert="off"
pushbullettoken="accesstoken"
# Start Variables
updateonstart="off"
fn_parms(){
parms="-fg -ini ${servercfgfullpath}"
}
#### Advanced Variables ####
# Github Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="dgibbs64"
githubrepo="linuxgsm"
githubbranch="master"
# Server Details
gamename="Mumble"
servicename="mumble-server"
@ -46,7 +64,7 @@ backupdir="${rootdir}/backups"
# Logging
logdays="7"
logdir="${rootdir}/log"
gamelogdir="${rootdir}/log"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
consolelogging="on"
@ -58,17 +76,6 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
fn_parms(){
parms="-fg -ini ${servercfgfullpath}"
}
# Github Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="dgibbs64"
githubrepo="linuxgsm"
githubbranch="master"
##### Script #####
# Do not edit

4
lgsm/functions/alert.sh

@ -41,9 +41,9 @@ elif [ "${alert}" == "test" ]; then
fn_alert_test
fi
if [ "${emailnotification}" == "on" ]||[ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then
if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then
alert_email.sh
elif [ "${emailnotification}" != "on" ]||[ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
elif [ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_warn_nl "Email alerts not enabled"
fn_script_log_warn "Email alerts not enabled"
elif [ -z "${email}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then

26
lgsm/functions/check_permissions.sh

@ -9,21 +9,23 @@ local commandname="CHECK"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_check_ownership(){
if [ $(find "${filesdir}" -not -user $(whoami)|wc -l) -ne "0" ]||[ $(find "${rootdir}/${selfname}" -not -user $(whoami)|wc -l) -ne "0" ]; then
fn_print_fail_nl "Permissions issues found"
fn_script_log_fatal "Permissions issues found"
fn_print_infomation_nl "The current user ($(whoami)) does not have ownership of the following files:"
fn_script_log_info "The current user ($(whoami)) does not have ownership of the following files:"
{
echo -e "User\tGroup\tFile\n"
find "${filesdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
} | column -s $'\t' -t | tee -a "${scriptlog}"
core_exit.sh
if [ -d "${filesdir}" ]; then
if [ $(find "${filesdir}" -not -user $(whoami)|wc -l) -ne "0" ]||[ $(find "${rootdir}/${selfname}" -not -user $(whoami)|wc -l) -ne "0" ]; then
fn_print_fail_nl "Permissions issues found"
fn_script_log_fatal "Permissions issues found"
fn_print_infomation_nl "The current user ($(whoami)) does not have ownership of the following files:"
fn_script_log_info "The current user ($(whoami)) does not have ownership of the following files:"
{
echo -e "User\tGroup\tFile\n"
find "${filesdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
} | column -s $'\t' -t | tee -a "${scriptlog}"
core_exit.sh
fi
fi
}
fn_check_permissions(){
if [ -n "${functionsdir}" ]; then
if [ -d "${functionsdir}" ]; then
if [ $(find "${functionsdir}" -type f -not -executable|wc -l) -ne "0" ]; then
fn_print_fail_nl "Permissions issues found"
fn_script_log_fatal "Permissions issues found"
@ -56,4 +58,4 @@ fn_check_permissions(){
}
fn_check_ownership
fn_check_permissions
fn_check_permissions

11
lgsm/functions/check_status.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM check_status.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Checks the process status of the server. Either online or offline.
@ -18,6 +19,16 @@ if [ "${gamename}" == "TeamSpeak 3" ]; then
ts3error="${status}"
status=0
fi
elif [ "${gamename}" == "Mumble" ]; then
# 1: Server is listening
# 0: Server is not listening, considered closed
mumblepid=$(netstat -nap 2>/dev/null | grep udp | grep 64738 | grep murmur | awk '{ print $6 }' | awk -F'/' '{ print $1 }')
if [ -z "${mumblepid}" ]; then
status=0
else
status=1
fi
else
status=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fi

17
lgsm/functions/command_details.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM command_details.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Displays server infomation.
@ -43,7 +44,7 @@ fn_details_performance(){
# Avg Load: 1.00, 1.01, 0.78
#
# Mem: total used free cached
# Physical: 741M 656M 85M 256M
# Physical: 741M 656M 85M 256M
# Swap: 0B 0B 0B
echo -e ""
@ -286,7 +287,7 @@ fn_details_ports(){
echo -e "Change ports by editing the parameters in:"
parmslocation="${red}UNKNOWN${default}"
local ports_edit_array=( "avalanche" "dontstarve" "projectzomboid" "idtech3" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "TeamSpeak 3" "7 Days To Die" )
local ports_edit_array=( "avalanche" "dontstarve" "projectzomboid" "idtech3" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "TeamSpeak 3" "Mumble" "7 Days To Die" )
for port_edit in "${ports_edit_array[@]}"
do
if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
@ -441,6 +442,16 @@ fn_details_teamspeak3(){
} | column -s $'\t' -t
}
fn_details_mumble(){
echo -e "netstat -atunp | grep murmur"
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Voice\tINBOUND\t${port}\tudp"
echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
} | column -s $'\t' -t
}
fn_details_teeworlds(){
echo -e "netstat -atunp | grep teeworlds_srv"
echo -e ""
@ -608,6 +619,8 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
fn_details_sdtd
elif [ "${gamename}" == "TeamSpeak 3" ]; then
fn_details_teamspeak3
elif [ "${gamename}" == "Mumble" ]; then
fn_details_mumble
elif [ "${gamename}" == "Rust" ]; then
fn_details_rust
else

5
lgsm/functions/command_install.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM command_install.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Overall function for the installer.
@ -17,7 +18,7 @@ check_deps.sh
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
install_server_files.sh
install_ut2k4_key.sh
elif [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "TeamSpeak 3" ]; then
elif [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]; then
installer=1
install_server_files.sh
elif [ -n "${appid}" ]; then
@ -35,4 +36,4 @@ fi
fix.sh
install_complete.sh
core_exit.sh
core_exit.sh

22
lgsm/functions/command_monitor.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM command_monitor.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Monitors server by checking for running processes.
# then passes to monitor_gsquery.sh.
@ -54,6 +55,23 @@ fn_monitor_teamspeak3(){
fi
}
fn_monitor_mumble(){
if [ "${status}" != "0" ]; then
fn_print_ok "Checking session: "
fn_print_ok_eol_nl
fn_script_log_pass "Checking session: OK"
else
fn_print_error "Checking session: Not listening to port ${port}"
fn_print_fail_eol_nl
fn_script_log_error "Checking session: Not listening to port ${port}"
failurereason="Checking session: Not listening to port ${port}"
alert="restart"
alert.sh
fn_script_log_info "Monitor is starting ${servername}"
sleep 1
command_restart.sh
fi
}
fn_monitor_tmux(){
# checks that tmux session is running
if [ "${status}" != "0" ]; then
@ -92,7 +110,9 @@ fn_monitor_check_update
fn_monitor_msg_checking
if [ "${gamename}" == "TeamSpeak 3" ]; then
fn_monitor_teamspeak3
elif [ "${gamename}" == "Mumble" ]; then
fn_monitor_mumble
else
fn_monitor_tmux
fi
core_exit.sh
core_exit.sh

3
lgsm/functions/command_start.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM command_start.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Starts the server.
@ -182,4 +183,4 @@ if [ "${gamename}" == "TeamSpeak 3" ]; then
else
fn_start_tmux
fi
core_exit.sh
core_exit.sh

30
lgsm/functions/command_stop.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM command_stop.sh function
# Author: Daniel Gibbs
# Contributors: UltimateByte
# Website: https://gameservermanagers.com
# Description: Stops the server.
@ -208,7 +209,24 @@ fn_stop_teamspeak3(){
fn_script_log_pass "Stopped ${servername}"
else
fn_print_fail_nl "Unable to stop ${servername}"
fn_script_log_fail "Unable to stop ${servername}"
fn_script_log_error "Unable to stop ${servername}"
fi
}
fn_stop_mumble(){
fn_print_dots "Stopping ${servername}"
mumblepid=$(netstat -nap 2>/dev/null | grep udp | grep 64738 | grep murmur | awk '{ print $6 }' | awk -F'/' '{ print $1 }')
kill ${mumblepid}
sleep 1
check_status.sh
if [ "${status}" == "0" ]; then
# Remove lock file
rm -f "${rootdir}/${lockselfname}"
fn_stop_tmux
fn_script_log_pass "Stopped ${servername}"
else
fn_print_fail_nl "Unable to stop ${servername}"
fn_script_log_error "Unable to stop ${servername}"
fi
}
@ -247,8 +265,14 @@ fn_stop_pre_check(){
else
fn_stop_teamspeak3
fi
elif [ "${gamename}" == "Mumble" ]; then
if [ "${status}" == "0" ]; then
fn_print_info_nl "${servername} is already stopped"
fn_script_log_error "${servername} is already stopped"
else
fn_stop_mumble
fi
else
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_info_nl "${servername} is already stopped"
fn_script_log_error "${servername} is already stopped"
@ -263,4 +287,4 @@ sleep 1
check.sh
info_config.sh
fn_stop_pre_check
core_exit.sh
core_exit.sh

4
lgsm/functions/command_update.sh

@ -15,8 +15,10 @@ check.sh
if [ "${gamename}" == "TeamSpeak 3" ]; then
update_ts3.sh
elif [ "${gamename}" == "Mumble" ]; then
update_mumble.sh
else
update_steamcmd.sh
fi
core_exit.sh
core_exit.sh

7
lgsm/functions/core_dl.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM core_dl.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Deals with all downloads for LGSM.
@ -117,11 +118,11 @@ fn_fetch_file(){
if [ ${filename##*.} == "bz2" ]; then
echo -ne "downloading ${filename}..."
sleep 1
curlcmd=$(${curlcmd} --progress-bar --fail -o "${filedir}/${filename}" "${fileurl}")
curlcmd=$(${curlcmd} --progress-bar --fail -L -o "${filedir}/${filename}" "${fileurl}")
echo -ne "downloading ${filename}..."
else
echo -ne " fetching ${filename}...\c"
curlcmd=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${fileurl}" 2>&1)
curlcmd=$(${curlcmd} -s --fail -L -o "${filedir}/${filename}" "${fileurl}" 2>&1)
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@ -218,4 +219,4 @@ fn_update_function(){
force="noforce"
md5="nomd5"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
}
}

15
lgsm/functions/core_functions.sh

@ -5,9 +5,13 @@
# Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
# This function is called first before any other function. Without this file other functions will not load.
# Fix for TeamSpeak 3 scripts using gamename="Teamspeak 3"
if [ "${gamename}" == "Teamspeak 3" ]; then
gamename="TeamSpeak 3"
# Fixes for legacy code
if [ "${gamename}" == "Teamspeak 3" ]; then
gamename="TeamSpeak 3"
fi
if [ "${emailnotification}" == "on" ]; then
emailalert="on"
fi
# Code/functions for legacy servers
@ -388,6 +392,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
update_mumble.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
update_steamcmd.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function

17
lgsm/functions/core_getopt.sh

@ -138,20 +138,22 @@ case "${getopt}" in
command_stop.sh;;
r|restart)
command_restart.sh;;
u|update)
command_update.sh;;
uf|update-functions)
command_update_functions.sh;;
m|monitor)
command_monitor.sh;;
ta|test-alert)
command_test_alert.sh;;
dt|details)
command_details.sh;;
b|backup)
command_backup.sh;;
dev|dev-debug)
command_dev_debug.sh;;
console)
command_console.sh;;
d|debug)
command_debug.sh;;
i|install)
command_install.sh;;
dd|depsdetect)
command_dev_detect_deps.sh;;
*)
@ -168,12 +170,13 @@ case "${getopt}" in
echo -e "${blue}start\t${default}st |Start the server."
echo -e "${blue}stop\t${default}sp |Stop the server."
echo -e "${blue}restart\t${default}r |Restart the server."
echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
echo -e "${blue}monitor\t${default}m |Checks that the server is running."
echo -e "${blue}test-alert\t${default}ta |Sends test alert."
echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
echo -e "${blue}backup\t${default}b |Create archive of the server."
echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
echo -e "${blue}install\t${default}i |Install the server."
} | column -s $'\t' -t
esac
}
@ -460,4 +463,4 @@ elif [ "${engine}" == "unreal" ]; then
else
fn_getopt_generic
fi
core_exit.sh
core_exit.sh

29
lgsm/functions/info_config.sh

@ -1,6 +1,7 @@
#!/bin/bash
# LGSM info_config.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Gets specific details from config files.
@ -220,6 +221,28 @@ fn_info_config_teamspeak3(){
fi
}
fn_info_config_mumble(){
if [ ! -f "${servercfgfullpath}" ]; then
port="64738"
queryport="${port}"
servername="Mumble"
else
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(cat "${servercfgfullpath}" | grep "host=" | awk -F'=' '{ print $2}')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
port=$(cat "${servercfgfullpath}" | grep 'port=' | awk -F'=' '{ print $2 }')
queryport="${port}"
# Not Set
port=${port:-"64738"}
queryport=${queryport:-"64738"}
servername="Mumble Port ${port}"
fi
}
fn_info_config_teeworlds(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="unnamed server"
@ -302,7 +325,7 @@ fn_info_config_unreal(){
webadminpass=${webadminpass:-"NOT SET"}
fi
}
fn_info_config_sdtd(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
@ -325,7 +348,7 @@ fn_info_config_sdtd(){
queryport=$((port + 1))
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
@ -378,6 +401,8 @@ elif [ "${engine}" == "starbound" ]; then
# TeamSpeak 3
elif [ "${gamename}" == "TeamSpeak 3" ]; then
fn_info_config_teamspeak3
elif [ "${gamename}" == "Mumble" ]; then
fn_info_config_mumble
# Teeworlds
elif [ "${engine}" == "teeworlds" ]; then
fn_info_config_teeworlds

3
lgsm/functions/info_glibc.sh

@ -71,6 +71,9 @@ elif [ "${engine}" == "unity3d" ]; then
elif [ "${gamename}" == "TeamSpeak 3" ]; then
glibcrequired="NOT REQUIRED"
glibcfix="no"
elif [ "${gamename}" == "Mumble" ]; then
glibcrequired="NOT REQUIRED"
glibcfix="no"
else
glibcrequired="UNKNOWN"
glibcfix="no"

2
lgsm/functions/install_server_files.sh

@ -95,6 +95,8 @@ sleep 1
if [ "${gamename}" == "TeamSpeak 3" ]; then
update_ts3.sh
elif [ "${gamename}" == "Mumble" ]; then
update_mumble.sh
elif [ -z "${appid}" ]||[ "${gamename}" == "GoldenEye: Source" ]; then
fn_install_server_files
fi

165
lgsm/functions/update_mumble.sh

@ -0,0 +1,165 @@
#!/bin/bash
# LGSM update_mumble.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Handles updating of mumble servers.
local commandname="UPDATE"
local commandaction="Update"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_update_mumble_dl(){
fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${lgsmdir}/tmp" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2"
fn_dl_extract "${lgsmdir}/tmp" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${lgsmdir}/tmp"
echo -e "copying to ${filesdir}...\c"
fn_script_log "Copying to ${filesdir}"
cp -R "${lgsmdir}/tmp/murmur-static_${mumblearch}-${availablebuild}/"* "${filesdir}"
local exitcode=$?
if [ ${exitcode} -eq 0 ]; then
fn_print_ok_eol_nl
else
fn_print_fail_eol_nl
fi
}
fn_update_mumble_currentbuild(){
# Gets current build info
# Checks if current build info is available. If it fails, then a server restart will be forced to generate logs.
if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then
fn_print_error "Checking for update: GitHub"
sleep 1
fn_print_error_nl "Checking for update: GitHub: No logs with server version found"
fn_script_log_error "Checking for update: GitHub: No logs with server version found"
sleep 1
fn_print_info_nl "Checking for update: GitHub: Forcing server restart"
fn_script_log_info "Checking for update: GitHub: Forcing server restart"
sleep 1
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
sleep 1
# Check again and exit on failure.
if [ ! -f "${consolelogdir}/${servicename}-console.log" ]; then
fn_print_fail_nl "Checking for update: GitHub: Still No logs with server version found"
fn_script_log_fatal "Checking for update: GitHub: Still No logs with server version found"
core_exit.sh
fi
fi
# Get current build from logs
currentbuild=$(cat "${consolelogdir}"/"${servicename}"-console.log 2> /dev/null | sort | egrep 'Murmur ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | awk '{print $4}')
if [ -z "${currentbuild}" ]; then
fn_print_error_nl "Checking for update: GitHub: Current build version not found"
fn_script_log_error "Checking for update: GitHub: Current build version not found"
sleep 1
fn_print_info_nl "Checking for update: GitHub: Forcing server restart"
fn_script_log_info "Checking for update: GitHub: Forcing server restart"
exitbypass=1
command_stop.sh
exitbypass=1
command_start.sh
currentbuild=$(cat "${consolelogdir}"/"${servicename}"-console.log 2> /dev/null | sort | egrep 'Murmur ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | awk '{print $4}')
if [ -z "${currentbuild}" ]; then
fn_print_fail_nl "Checking for update: GitHub: Current build version still not found"
fn_script_log_fatal "Checking for update: GitHub: Current build version still not found"
core_exit.sh
fi
fi
}
fn_update_mumble_arch(){
# Mumble is x86 only for now
mumblearch="x86"
}
fn_update_mumble_availablebuild(){
# Gets latest build info.
availablebuild=$(curl -s https://api.github.com/repos/mumble-voip/mumble/releases/latest | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }')
sleep 1
# Checks if availablebuild variable has been set
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: GitHub"
sleep 1
fn_print_fail "Checking for update: GitHub: Not returning version info"
fn_script_log_fatal "Failure! Checking for update: GitHub: Not returning version info"
core_exit.sh
else
fn_print_ok_nl "Checking for update: GitHub"
fn_script_log_pass "Checking for update: GitHub"
sleep 1
fi
}
fn_update_mumble_compare(){
# Removes dots so if can compare version numbers
currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
echo -e "\n"
echo -e "Update available:"
sleep 1
echo -e " Current build: ${red}${currentbuild} ${mumblearch}${default}"
echo -e " Available build: ${green}${availablebuild} ${mumblearch}${default}"
echo -e ""
sleep 1
echo ""
echo -en "Applying update.\r"
sleep 1
echo -en "Applying update..\r"
sleep 1
echo -en "Applying update...\r"
sleep 1
echo -en "\n"
fn_script_log "Update available"
fn_script_log "Current build: ${currentbuild}"
fn_script_log "Available build: ${availablebuild}"
fn_script_log "${currentbuild} > ${availablebuild}"
unset updateonstart
check_status.sh
if [ "${status}" == "0" ]; then
fn_update_mumble_dl
exitbypass=1
command_start.sh
exitbypass=1
command_stop.sh
else
exitbypass=1
command_stop.sh
fn_update_mumble_dl
exitbypass=1
command_start.sh
fi
alert="update"
alert.sh
else
echo -e "\n"
echo -e "No update available:"
echo -e " Current version: ${green}${currentbuild}${default}"
echo -e " Available version: ${green}${availablebuild}${default}"
echo -e ""
fn_print_ok_nl "No update available"
fn_script_log_info "Current build: ${currentbuild}"
fn_script_log_info "Available build: ${availablebuild}"
fi
}
fn_update_mumble_arch
if [ "${installer}" == "1" ]; then
fn_update_mumble_availablebuild
fn_update_mumble_dl
else
# Checks for server update from github.com
fn_print_dots "Checking for update: github.com"
fn_script_log_info "Checking for update: github.com"
sleep 1
fn_update_mumble_currentbuild
fn_update_mumble_availablebuild
fn_update_mumble_compare
fi

75
lgsm/functions/update_ts3.sh

@ -47,6 +47,7 @@ fn_update_ts3_currentbuild(){
fi
fi
# Get current build from logs
currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
if [ -z "${currentbuild}" ]; then
fn_print_error_nl "Checking for update: teamspeak.com: Current build version not found"
@ -76,52 +77,52 @@ elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
ts3arch="x86"
else
echo ""
fn_print_failure "unknown or unsupported architecture: ${arch}"
fn_script_log_fatal "unknown or unsupported architecture: ${arch}"
fn_print_failure "Unknown or unsupported architecture: ${arch}"
fn_script_log_fatal "Unknown or unsupported architecture: ${arch}"
core_exit.sh
fi
}
fn_update_ts3_availablebuild(){
# Gets availablebuild info.
# Gets latest build info.
# Creates tmp dir if missing
if [ ! -d "${lgsmdir}/tmp" ]; then
mkdir -p "${lgsmdir}/tmp"
fi
# Creates tmp dir if missing
if [ ! -d "${lgsmdir}/tmp" ]; then
mkdir -p "${lgsmdir}/tmp"
fi
# Grabs all version numbers but not in correct order.
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp"
# Grabs all version numbers but not in correct order.
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp"
# Sort version numbers
cat "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" | sort -r --version-sort -o "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Sort version numbers
cat "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" | sort -r --version-sort -o "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Finds directory with most recent server version.
while read ts3_version_number; do
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
if [ $? -eq 0 ]; then
availablebuild="${ts3_version_number}"
# Break while-loop, if the latest release could be found.
break
fi
done < "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Finds directory with most recent server version.
while read ts3_version_number; do
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
if [ $? -eq 0 ]; then
availablebuild="${ts3_version_number}"
# Break while-loop, if the latest release could be found.
break
fi
done < "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Tidy up
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp"
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Tidy up
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp"
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp"
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: teamspeak.com"
sleep 1
fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info"
core_exit.sh
else
fn_print_ok_nl "Checking for update: teamspeak.com"
fn_script_log_pass "Checking for update: teamspeak.com"
sleep 1
fi
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: teamspeak.com"
sleep 1
fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info"
core_exit.sh
else
fn_print_ok_nl "Checking for update: teamspeak.com"
fn_script_log_pass "Checking for update: teamspeak.com"
sleep 1
fi
}
fn_update_ts3_compare(){
@ -133,8 +134,8 @@ fn_update_ts3_compare(){
echo -e "\n"
echo -e "Update available:"
sleep 1
echo -e " Current build: ${red}${currentbuild} ${architecture}${default}"
echo -e " Available build: ${green}${availablebuild} ${architecture}${default}"
echo -e " Current build: ${red}${currentbuild} ${ts3arch}${default}"
echo -e " Available build: ${green}${availablebuild} ${ts3arch}${default}"
echo -e ""
sleep 1
echo ""

Loading…
Cancel
Save