Xenao

Launcher Ark Debian

Mar 14th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.31 KB | None | 0 0
  1. if [ -f ".dev-debug" ]; then
  2.     exec 5>dev-debug.log
  3.     BASH_XTRACEFD="5"
  4.     set -x
  5. fi
  6.  
  7. version="170128"
  8.  
  9.  
  10. port="7777"
  11. queryport="27015"
  12. rconport="27020"
  13. maxplayers="50"
  14. ip="0.0.0.0"
  15.  
  16.  
  17. fn_parms(){
  18. parms="\"TheIsland?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}? -automanagedmods\""
  19. }
  20.  
  21.  
  22. updateonstart="on"
  23.  
  24.  
  25. maxbackups="4"
  26. maxbackupdays="30"
  27. stoponbackup="on"
  28.  
  29.  
  30. consolelogging="on"
  31. logdays="7"
  32.  
  33.  
  34. appid="376030"
  35.  
  36.  
  37.  
  38. gamename="ARK: Survival Evolved"
  39. engine="unreal4"
  40.  
  41.  
  42. servicename="ark-server"
  43.  
  44.  
  45. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  46. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  47. lockselfname=".${servicename}.lock"
  48. lgsmdir="${rootdir}/lgsm"
  49. functionsdir="${lgsmdir}/functions"
  50. libdir="${lgsmdir}/lib"
  51. tmpdir="${lgsmdir}/tmp"
  52. filesdir="${rootdir}/serverfiles"
  53.  
  54.  
  55. systemdir="${filesdir}/ShooterGame"
  56. executabledir="${systemdir}/Binaries/Linux"
  57. executable="./ShooterGameServer"
  58. servercfgdir="${systemdir}/Saved/Config/LinuxServer"
  59. servercfg="GameUserSettings.ini"
  60. servercfgfullpath="${servercfgdir}/${servercfg}"
  61. servercfgdefault="${servercfgdir}/GameUserSettings.ini"
  62.  
  63.  
  64. backupdir="${rootdir}/backups"
  65.  
  66.  
  67. gamelogdir="${systemdir}/logs"
  68. scriptlogdir="${rootdir}/log/script"
  69. consolelogdir="${rootdir}/log/console"
  70. scriptlog="${scriptlogdir}/${servicename}-script.log"
  71. consolelog="${consolelogdir}/${servicename}-console.log"
  72. emaillog="${scriptlogdir}/${servicename}-email.log"
  73.  
  74.  
  75. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
  76. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
  77.  
  78.  
  79.  
  80. fn_fetch_core_dl(){
  81. github_file_url_dir="lgsm/functions"
  82. github_file_url_name="${functionfile}"
  83. filedir="${functionsdir}"
  84. filename="${github_file_url_name}"
  85. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  86.  
  87. if [ ! -f "${filedir}/${filename}" ]; then
  88.     if [ ! -d "${filedir}" ]; then
  89.         mkdir -p "${filedir}"
  90.     fi
  91.     echo -e "    fetching ${filename}...\c"
  92.     curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  93.     for curlcmd in ${curlpaths}
  94.     do
  95.         if [ -x "${curlcmd}" ]; then
  96.             break
  97.         fi
  98.     done
  99.     if [ "$(basename ${curlcmd})" == "curl" ]; then
  100.         curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  101.         if [ $? -ne 0 ]; then
  102.             echo -e "\e[0;31mFAIL\e[0m\n"
  103.             echo "${curlfetch}"
  104.             echo -e "${githuburl}\n"
  105.             exit 1
  106.         else
  107.             echo -e "\e[0;32mOK\e[0m"
  108.         fi
  109.     else
  110.         echo -e "\e[0;31mFAIL\e[0m\n"
  111.         echo "Curl is not installed!"
  112.         echo -e ""
  113.         exit 1
  114.     fi
  115.     chmod +x "${filedir}/${filename}"
  116. fi
  117. source "${filedir}/${filename}"
  118. }
  119.  
  120. core_dl.sh(){
  121. functionfile="${FUNCNAME}"
  122. fn_fetch_core_dl
  123. }
  124.  
  125. core_functions.sh(){
  126. functionfile="${FUNCNAME}"
  127. fn_fetch_core_dl
  128. }
  129.  
  130.  
  131. if [ "$(whoami)" = "root" ]; then
  132.     if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
  133.         echo "[ FAIL ] Do NOT run this script as root!"
  134.         exit 1
  135.     else
  136.         core_functions.sh
  137.         check_root.sh
  138.     fi
  139. fi
  140.  
  141. core_dl.sh
  142. core_functions.sh
  143. getopt=$1
  144. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment