From 2b52626cf06db8a811c439870995b7ff41a57650 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 18:56:39 -0500 Subject: [PATCH 01/22] Pastebin and hastebin posting subsystem for scripting the posting of stripped confidential information to pastebin/hastebin. --- lgsm/functions/command_details.sh | 10 +- lgsm/functions/command_postdetails.sh | 136 ++++++++++++++++++++++++++ lgsm/functions/core_functions.sh | 12 +++ lgsm/functions/core_getopt.sh | 16 ++- 4 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 lgsm/functions/command_postdetails.sh diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 0cc18d692..cff501c27 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -580,6 +580,8 @@ fn_details_ark(){ # Run checks and gathers details to display. + +fn_display_details() { check.sh info_config.sh info_distro.sh @@ -642,4 +644,10 @@ else fi fn_details_statusbottom -core_exit.sh \ No newline at end of file +} + +if [ -z ${POSTDETAILS} ] ; +then + fn_display_details + core_exit.sh +fi diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh new file mode 100644 index 000000000..22736fd52 --- /dev/null +++ b/lgsm/functions/command_postdetails.sh @@ -0,0 +1,136 @@ +#!/bin/bash -x +# LGSM command_postdetails.sh function +# Author: CedarLUG +# Contributor: CedarLUG +# Website: https://gameservermanagers.com +# Description: Strips sensitive information out of Details output + +local commandname="POSTDETAILS" +local commandaction="Postdetails" +local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" + +# POSTDETAILS variable affects the output of command_details.sh. Setting +# it here silences the output from sourcing command_details.sh. +POSTDETAILS=yes + +# Set POSTTARGET to the appropriately-defined post destination. The present +# option is only pastebin, but hastebin is on the todo list (and should be +# a lot easier than pastebin. +# +# Another reason for an alternative here is that pastebin limits guest +# posts to 10 per day, which might be a tight limit for some debugging situations. + +POSTTARGET="http://pastebin.com" +POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc. + +# This file sources the command_details.sh file to leverage all +# of the already-defined functions. To keep the command_details.sh +# from actually producing output, the main executable statements have +# been wrapped in the equivalent of an ifdef clause, that looks +# for the variable "postdetails" to be defined. -CedarLUG + +# source all of the functions defined in the details command +. ${functionsdir}/command_details.sh + +fn_bad_tmpfile() { + echo "There was a problem creating a temporary file ${tmpfile}." + core_exit.sh +} + +fn_gen_rand() { + # This is just a simple random generator to generate a random + # name for storing the output. Named pipes would (possibly) be + # better. -CedarLUG + # + # len holds the number of digits in our random string + local len=$1 + # If not specified, default to 10. + : {len:=10} + # Quick generator for a random filename, pulled from /dev/urandom + tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len} | xargs +} + +# Rather than a one-pass sed parser, default to using a temporary directory +filedir="${lgsmdir}/tmp" + +# Not all game servers possess a tmp directory. So create it if +# it doesn't already exist +mkdir -p ${filedir} 2>&1 >/dev/null + +tmpfile=${filedir}/$(fn_gen_rand 10).tmp + +touch ${tmpfile} || fn_bad_tmpfile + +# fn_display_details is found in the command_details.sh file (which +# was sourced above. The output is parsed for passwords and other +# confidential information. -CedarLUG + +# The numerous sed lines could certainly be condensed quite a bit, +# but they are separated out to provide examples for how to add +# additional criteria in a straight-forward manner. +# (This was originally a sed one-liner.) -CedarLUG + +fn_display_details | sed -e 's/password="[^"]*/password="--stripped--/' | + sed -e 's/password "[^"]*/password "--stripped--/' | + sed -e 's/password: .*/password: --stripped--/' | + sed -e 's/gslt="[^"]*/gslt="--stripped--/' | + sed -e 's/gslt "[^"]*/gslt "--stripped--/' | + sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' | + sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' | + sed -e 's/authkey="[^"]*/authkey="--stripped--/' | + sed -e 's/authkey "[^"]*/authkey "--stripped--/' | + sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' | + sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' | + sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' | + sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' | + sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' | + sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' | + sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' | + sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' | + sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' | + sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' | + sed -e 's/pass="[^"]*/pass="--stripped--/' | + sed -e 's/pass "[^"]*/pass "--stripped--/' | + sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | + sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > ${tmpfile} + +# strip off all console escape codes (colorization) +sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" ${tmpfile} + +# If the gameserver uses anonymous steam credentials, leave them displayed +# in the output. Otherwise, strip these out as well. +if ! grep -q "^steampass[= ]\"\"" ${tmpfile} ; then + sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' ${tmpfile} +fi +if ! grep -q "^steamuser[= ]\"anonymous\"" ${tmpfile} ; then + sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' ${tmpfile} +fi + +if [ "$POSTTARGET" == "http://pastebin.com" ] ; then + # grab the return from 'value' from an initial visit to pastebin. + TOKEN=$(curl -s $POSTTARGET | + sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') + # + # Use the TOKEN to then post the content. + # + link=$(curl -s "$POSTTARGET/post.php" -D - -F "submit_hidden=submit_hidden" \ + -F "post_key=$TOKEN" -F "paste_expire_date=${POSTEXPIRE}" \ + -F "paste_name=${gamename} Debug Info" \ + -F "paste_format=8" -F "paste_private=0" \ + -F "paste_type=bash" -F "paste_code=<${tmpfile}" | + awk '/^location: / { print $2 }' | sed "s/\n//g") + + # Output the resulting link. + fn_print_warn_nl "You now need to visit (and verify) the content posted at ${POSTTARGET}${link}" +elif [ "$POSTTARGET" == "http://hastebin.com" ] ; then + # hastebin is a bit simpler. If successful, the returned result + # should look like: {"something":"key"}, putting the reference that + # we need in "key". TODO - error handling. -CedarLUG + link=$(curl -s -d "$(<${tmpfile}) | cut -d\" -f4) + fn_print_warn_nl "You now need to visit (and verify) the content posted at ${POSTTARGET}${link}" +fi + +# cleanup +rm ${tmpfile} || /bin/true + +core_exit.sh diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index de36e7a21..47903be22 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -120,6 +120,18 @@ functionfile="${FUNCNAME}" fn_fetch_function } +command_postdetails.sh(){ + functionfile="${FUNCNAME}" + tempffname=$functionfile + # First, grab the command_postdetails.sh file + fn_fetch_function + # But then next, command_details.sh needs to also be pulled + # because command_postdetails.sh sources its functions -CedarLUG + functionfile="command_details.sh" + fn_fetch_function + functionfile=$tempffname +} + command_postdetails.sh(){ functionfile="${FUNCNAME}" tempffname=$functionfile diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 5b7042f8c..78d142e9c 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -29,6 +29,8 @@ case "${getopt}" in command_test_alert.sh;; dt|details) command_details.sh;; + pd|postdetails) + command_postdetails.sh;; b|backup) command_backup.sh;; c|console) @@ -68,6 +70,7 @@ case "${getopt}" in 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 information about the server." + echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" 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." @@ -95,6 +98,8 @@ case "${getopt}" in command_test_alert.sh;; dt|details) command_details.sh;; + pd|postdetails) + command_postdetails.sh;; b|backup) command_backup.sh;; pw|change-password) @@ -130,6 +135,7 @@ case "${getopt}" in 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 information about the server." + echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password." echo -e "${blue}backup\t${default}b |Create archive of the server." echo -e "${blue}install\t${default}i |Install the server." @@ -156,6 +162,8 @@ case "${getopt}" in command_test_alert.sh;; dt|details) command_details.sh;; + pd|postdetails) + command_postdetails.sh;; b|backup) command_backup.sh;; c|console) @@ -193,6 +201,7 @@ case "${getopt}" in 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}postdetails\t${default}pd | Post stripped details to pastebin (for support)" 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." @@ -220,6 +229,8 @@ case "${getopt}" in command_test_alert.sh;; dt|details) command_details.sh;; + pd|postdetails) + command_postdetails.sh;; b|backup) command_backup.sh;; dev|dev-debug) @@ -251,6 +262,7 @@ case "${getopt}" in 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 information about the server." + echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" echo -e "${blue}backup\t${default}b |Create archive of the server." echo -e "${blue}install\t${default}i |Install the server." } | column -s $'\t' -t @@ -280,6 +292,8 @@ case "${getopt}" in command_test_alert.sh;; dt|details) command_details.sh;; + pd|postdetails) + command_postdetails.sh;; b|backup) command_backup.sh;; c|console) @@ -557,4 +571,4 @@ elif [ "${engine}" == "unreal" ]; then else fn_getopt_generic fi -core_exit.sh \ No newline at end of file +core_exit.sh From f88f3d27cf9e829848440aefebe63a6c39f2abd3 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 19:12:00 -0500 Subject: [PATCH 02/22] Formalizing hastebin and fixing a missing quote and slash --- lgsm/functions/command_postdetails.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 22736fd52..252c19dbe 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -20,7 +20,7 @@ POSTDETAILS=yes # Another reason for an alternative here is that pastebin limits guest # posts to 10 per day, which might be a tight limit for some debugging situations. -POSTTARGET="http://pastebin.com" +POSTTARGET="http://hastebin.com" POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc. # This file sources the command_details.sh file to leverage all @@ -121,13 +121,13 @@ if [ "$POSTTARGET" == "http://pastebin.com" ] ; then awk '/^location: / { print $2 }' | sed "s/\n//g") # Output the resulting link. - fn_print_warn_nl "You now need to visit (and verify) the content posted at ${POSTTARGET}${link}" + fn_print_warn_nl "Visit (and verify) the content posted at ${POSTTARGET}${link}" elif [ "$POSTTARGET" == "http://hastebin.com" ] ; then # hastebin is a bit simpler. If successful, the returned result # should look like: {"something":"key"}, putting the reference that # we need in "key". TODO - error handling. -CedarLUG - link=$(curl -s -d "$(<${tmpfile}) | cut -d\" -f4) - fn_print_warn_nl "You now need to visit (and verify) the content posted at ${POSTTARGET}${link}" + link=$(curl -s -d "$(<${tmpfile})" ${POSTTARGET}/documents| cut -d\" -f4) + fn_print_warn_nl "Visit (and verify) the content posted at ${POSTTARGET}/${link}" fi # cleanup From f2472ce21d1d9b507ce985dae948e90dd5f066d8 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 19:51:37 -0500 Subject: [PATCH 03/22] Updating the comment regarding eventual hastebin support hastebin support has been added. --- lgsm/functions/command_postdetails.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 252c19dbe..28b2b49db 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -13,14 +13,13 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" # it here silences the output from sourcing command_details.sh. POSTDETAILS=yes -# Set POSTTARGET to the appropriately-defined post destination. The present -# option is only pastebin, but hastebin is on the todo list (and should be -# a lot easier than pastebin. -# -# Another reason for an alternative here is that pastebin limits guest -# posts to 10 per day, which might be a tight limit for some debugging situations. +# Set POSTTARGET to the appropriately-defined post destination. +# The only options for POSTTARGET are +#POSTTARGET="http://pastebin.com" POSTTARGET="http://hastebin.com" + +# For pastebin, you can set the expiration period. POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc. # This file sources the command_details.sh file to leverage all From 6bacc4334f7c1f21885412435915a9d2444da8e1 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 19:54:16 -0500 Subject: [PATCH 04/22] Need to have the second call the original command_details.sh() --- lgsm/functions/core_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 47903be22..3d50a18a3 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -132,7 +132,7 @@ command_postdetails.sh(){ functionfile=$tempffname } -command_postdetails.sh(){ +command_details.sh(){ functionfile="${FUNCNAME}" tempffname=$functionfile fn_fetch_function From b105682b102ba92a55e0319950723c077f48f466 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 19:58:00 -0500 Subject: [PATCH 05/22] Indent to highlight the new function --- lgsm/functions/command_details.sh | 124 +++++++++++++++--------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index cff501c27..87b958bc4 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -582,68 +582,68 @@ fn_details_ark(){ # Run checks and gathers details to display. fn_display_details() { -check.sh -info_config.sh -info_distro.sh -info_glibc.sh -info_parms.sh -fn_details_os -fn_details_performance -fn_details_disk -fn_details_gameserver -fn_details_script -fn_details_backup -# Some game servers do not have parms. -if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then - fn_parms - fn_details_commandlineparms -fi -fn_details_ports - -# Display details depending on game or engine. -if [ "${engine}" == "avalanche" ]; then - fn_details_avalanche -elif [ "${engine}" == "dontstarve" ]; then - fn_details_dontstarve -elif [ "${engine}" == "lwjgl2" ]; then - fn_details_minecraft -elif [ "${engine}" == "projectzomboid" ]; then - fn_details_projectzomboid -elif [ "${engine}" == "idtech3" ]; then - fn_details_idtech3 -elif [ "${engine}" == "realvirtuality" ]; then - fn_details_realvirtuality -elif [ "${engine}" == "seriousengine35" ]; then - fn_details_seriousengine35 -elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then - fn_details_source -elif [ "${engine}" == "spark" ]; then - fn_details_spark -elif [ "${engine}" == "starbound" ]; then - fn_details_starbound -elif [ "${engine}" == "teeworlds" ]; then - fn_details_teeworlds -elif [ "${engine}" == "terraria" ]; then - fn_details_terraria -elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then - fn_details_unreal -elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then - fn_details_ark -elif [ "${gamename}" == "Hurtworld" ]; then - fn_details_hurtworld -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 - fn_print_error_nl "Unable to detect server engine." -fi - -fn_details_statusbottom + check.sh + info_config.sh + info_distro.sh + info_glibc.sh + info_parms.sh + fn_details_os + fn_details_performance + fn_details_disk + fn_details_gameserver + fn_details_script + fn_details_backup + # Some game servers do not have parms. + if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then + fn_parms + fn_details_commandlineparms + fi + fn_details_ports + + # Display details depending on game or engine. + if [ "${engine}" == "avalanche" ]; then + fn_details_avalanche + elif [ "${engine}" == "dontstarve" ]; then + fn_details_dontstarve + elif [ "${engine}" == "lwjgl2" ]; then + fn_details_minecraft + elif [ "${engine}" == "projectzomboid" ]; then + fn_details_projectzomboid + elif [ "${engine}" == "idtech3" ]; then + fn_details_idtech3 + elif [ "${engine}" == "realvirtuality" ]; then + fn_details_realvirtuality + elif [ "${engine}" == "seriousengine35" ]; then + fn_details_seriousengine35 + elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then + fn_details_source + elif [ "${engine}" == "spark" ]; then + fn_details_spark + elif [ "${engine}" == "starbound" ]; then + fn_details_starbound + elif [ "${engine}" == "teeworlds" ]; then + fn_details_teeworlds + elif [ "${engine}" == "terraria" ]; then + fn_details_terraria + elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then + fn_details_unreal + elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then + fn_details_ark + elif [ "${gamename}" == "Hurtworld" ]; then + fn_details_hurtworld + 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 + fn_print_error_nl "Unable to detect server engine." + fi + + fn_details_statusbottom } if [ -z ${POSTDETAILS} ] ; From bdfa5a6a6e3bf4d298e688d0ae3552cf57dfd029 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 19:59:57 -0500 Subject: [PATCH 06/22] Clip extra --- lgsm/functions/core_functions.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 3d50a18a3..d98c469d6 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -132,15 +132,6 @@ command_postdetails.sh(){ functionfile=$tempffname } -command_details.sh(){ -functionfile="${FUNCNAME}" -tempffname=$functionfile -fn_fetch_function -functionfile="command_details.sh" -fn_fetch_function -functionfile=$tempffname -} - command_details.sh(){ functionfile="${FUNCNAME}" fn_fetch_function From 606e3b050fa47bb1cdb6572fe9cf7c212bea9f5e Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 20:03:26 -0500 Subject: [PATCH 07/22] Stripping the extra space to be consistent with the other output options --- lgsm/functions/core_getopt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 78d142e9c..106dd6676 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -70,7 +70,7 @@ case "${getopt}" in 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 information about the server." - echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" + echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)" 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." @@ -135,7 +135,7 @@ case "${getopt}" in 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 information about the server." - echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" + echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)" echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password." echo -e "${blue}backup\t${default}b |Create archive of the server." echo -e "${blue}install\t${default}i |Install the server." @@ -201,7 +201,7 @@ case "${getopt}" in 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}postdetails\t${default}pd | Post stripped details to pastebin (for support)" + echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)" 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." @@ -262,7 +262,7 @@ case "${getopt}" in 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 information about the server." - echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)" + echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)" echo -e "${blue}backup\t${default}b |Create archive of the server." echo -e "${blue}install\t${default}i |Install the server." } | column -s $'\t' -t From 54c258b50a4c7caec972ec7f59b54daf4a0b9128 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Sun, 11 Sep 2016 20:10:06 -0500 Subject: [PATCH 08/22] Minor: Correcting paren in comment. --- lgsm/functions/command_postdetails.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 28b2b49db..e78fcb7cd 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -61,7 +61,7 @@ tmpfile=${filedir}/$(fn_gen_rand 10).tmp touch ${tmpfile} || fn_bad_tmpfile # fn_display_details is found in the command_details.sh file (which -# was sourced above. The output is parsed for passwords and other +# was sourced above). The output is parsed for passwords and other # confidential information. -CedarLUG # The numerous sed lines could certainly be condensed quite a bit, From c0ecbc6cb36ce649cc6464544937e52718084de1 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 06:38:52 -0500 Subject: [PATCH 09/22] No longer debugging. --- lgsm/functions/command_postdetails.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index e78fcb7cd..30b8b1f9e 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash # LGSM command_postdetails.sh function # Author: CedarLUG # Contributor: CedarLUG From 60aff838cf5f1c0251325d655cc6d54dc68ed2a7 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 10:11:00 -0500 Subject: [PATCH 10/22] Remove abuse of filedir as a local variable --- lgsm/functions/command_postdetails.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 30b8b1f9e..0d65d183f 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -50,13 +50,13 @@ fn_gen_rand() { } # Rather than a one-pass sed parser, default to using a temporary directory -filedir="${lgsmdir}/tmp" +posttmpdir="${lgsmdir}/tmp" # Not all game servers possess a tmp directory. So create it if # it doesn't already exist -mkdir -p ${filedir} 2>&1 >/dev/null +mkdir -p ${posttmpdir} 2>&1 >/dev/null -tmpfile=${filedir}/$(fn_gen_rand 10).tmp +tmpfile=${posttmpdir}/$(fn_gen_rand 10).tmp touch ${tmpfile} || fn_bad_tmpfile From 49ede57e3e925dee2e063b96839f931627901ed5 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 10:37:06 -0500 Subject: [PATCH 11/22] Changing destination filename to include the date This will be left on the system if POSTTARGET is set to null --- lgsm/functions/command_postdetails.sh | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 0d65d183f..dd16e0e96 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -17,7 +17,7 @@ POSTDETAILS=yes # The only options for POSTTARGET are #POSTTARGET="http://pastebin.com" -POSTTARGET="http://hastebin.com" +POSTTARGET=${POSTTARGET="http://hastebin.com"} # For pastebin, you can set the expiration period. POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc. @@ -36,19 +36,6 @@ fn_bad_tmpfile() { core_exit.sh } -fn_gen_rand() { - # This is just a simple random generator to generate a random - # name for storing the output. Named pipes would (possibly) be - # better. -CedarLUG - # - # len holds the number of digits in our random string - local len=$1 - # If not specified, default to 10. - : {len:=10} - # Quick generator for a random filename, pulled from /dev/urandom - tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len} | xargs -} - # Rather than a one-pass sed parser, default to using a temporary directory posttmpdir="${lgsmdir}/tmp" @@ -56,7 +43,7 @@ posttmpdir="${lgsmdir}/tmp" # it doesn't already exist mkdir -p ${posttmpdir} 2>&1 >/dev/null -tmpfile=${posttmpdir}/$(fn_gen_rand 10).tmp +tmpfile=${posttmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp touch ${tmpfile} || fn_bad_tmpfile @@ -127,6 +114,9 @@ elif [ "$POSTTARGET" == "http://hastebin.com" ] ; then # we need in "key". TODO - error handling. -CedarLUG link=$(curl -s -d "$(<${tmpfile})" ${POSTTARGET}/documents| cut -d\" -f4) fn_print_warn_nl "Visit (and verify) the content posted at ${POSTTARGET}/${link}" +else + fn_print_warn_nl "Review the output in ${tmpfile}" + core_exit.sh fi # cleanup From 34ccd91c325416d74ed9c666ac25c8e3a7d73e85 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 10:44:22 -0500 Subject: [PATCH 12/22] Retro is so new. --- lgsm/functions/command_postdetails.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index dd16e0e96..72bb73032 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -37,7 +37,11 @@ fn_bad_tmpfile() { } # Rather than a one-pass sed parser, default to using a temporary directory -posttmpdir="${lgsmdir}/tmp" +if [ -d "${lgsmdir}" ]; then + posttmpdir="${lgsmdir}/tmp" +else + posttmpdir="${rootdir}/tmp" +fi # Not all game servers possess a tmp directory. So create it if # it doesn't already exist From 55aca22343138d2c7596d97a47624ebf8039a148 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 10:50:34 -0500 Subject: [PATCH 13/22] Updating the comment to reflect the correct default behavior. --- lgsm/functions/command_postdetails.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 72bb73032..c258d17dc 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -15,8 +15,22 @@ POSTDETAILS=yes # Set POSTTARGET to the appropriately-defined post destination. -# The only options for POSTTARGET are -#POSTTARGET="http://pastebin.com" +# The options for POSTTARGET are: +# The default destination - hastebin +# POSTTARGET="http://hastebin.com" +# +# Secondary destination - pastebin +# POSTTARGET="http://hastebin.com +# +# Third option - leave on the filesystem +# POSTTARGET= +# +# All of these options can be specified/overridden from the top-level +# invocation, as in: +# rustserver@gamerig:~$ POSTTARGET="http://pastebin.com" ./rustserver pd +# to post to pastebin, or +# rustserver@gamerig:~$ POSTTARGET= ./rustserver pd +# to leave the output on the filesystem. POSTTARGET=${POSTTARGET="http://hastebin.com"} # For pastebin, you can set the expiration period. From fd334a013ec047b189df983c557371ee0d467524 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 14:40:58 -0500 Subject: [PATCH 14/22] Updating with lgsm styling. --- lgsm/functions/command_details.sh | 2 +- lgsm/functions/command_postdetails.sh | 64 +++++++++++++-------------- lgsm/functions/core_functions.sh | 4 +- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 87b958bc4..fe7bfa154 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -646,7 +646,7 @@ fn_display_details() { fn_details_statusbottom } -if [ -z ${POSTDETAILS} ] ; +if [ -z "${postdetails}" ] ; then fn_display_details core_exit.sh diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index c258d17dc..e9bd5f36c 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -5,36 +5,38 @@ # Website: https://gameservermanagers.com # Description: Strips sensitive information out of Details output -local commandname="POSTDETAILS" +local commandname="postdetails" local commandaction="Postdetails" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" -# POSTDETAILS variable affects the output of command_details.sh. Setting +# postdetails variable affects the output of command_details.sh. Setting # it here silences the output from sourcing command_details.sh. -POSTDETAILS=yes +postdetails=yes -# Set POSTTARGET to the appropriately-defined post destination. +# Set posttarget to the appropriately-defined post destination. -# The options for POSTTARGET are: +# The options for posttarget are: # The default destination - hastebin -# POSTTARGET="http://hastebin.com" +# posttarget="http://hastebin.com" # # Secondary destination - pastebin -# POSTTARGET="http://hastebin.com +# posttarget="http://hastebin.com # # Third option - leave on the filesystem -# POSTTARGET= +# posttarget= # # All of these options can be specified/overridden from the top-level # invocation, as in: -# rustserver@gamerig:~$ POSTTARGET="http://pastebin.com" ./rustserver pd +# rustserver@gamerig:~$ posttarget="http://pastebin.com" ./rustserver pd # to post to pastebin, or -# rustserver@gamerig:~$ POSTTARGET= ./rustserver pd +# rustserver@gamerig:~$ posttarget= ./rustserver pd # to leave the output on the filesystem. -POSTTARGET=${POSTTARGET="http://hastebin.com"} +posttarget=${posttarget="http://hastebin.com"} # For pastebin, you can set the expiration period. -POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc. +# use 1 week as the default, other options are '24h' for a day, etc. +# This, too, may be overridden from the command line at the top-level +postexpire="${postexpire="1W"}" # This file sources the command_details.sh file to leverage all # of the already-defined functions. To keep the command_details.sh @@ -51,19 +53,15 @@ fn_bad_tmpfile() { } # Rather than a one-pass sed parser, default to using a temporary directory -if [ -d "${lgsmdir}" ]; then - posttmpdir="${lgsmdir}/tmp" -else - posttmpdir="${rootdir}/tmp" -fi +posttmpdir="${lgsmdir}/tmp" # Not all game servers possess a tmp directory. So create it if # it doesn't already exist -mkdir -p ${posttmpdir} 2>&1 >/dev/null +mkdir -p "${posttmpdir}" 2>&1 >/dev/null -tmpfile=${posttmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp +tmpfile="${posttmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp" -touch ${tmpfile} || fn_bad_tmpfile +touch "${tmpfile}" || fn_bad_tmpfile # fn_display_details is found in the command_details.sh file (which # was sourced above). The output is parsed for passwords and other @@ -96,44 +94,44 @@ fn_display_details | sed -e 's/password="[^"]*/password="--stripped--/' | sed -e 's/pass="[^"]*/pass="--stripped--/' | sed -e 's/pass "[^"]*/pass "--stripped--/' | sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | - sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > ${tmpfile} + sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > "${tmpfile}" # strip off all console escape codes (colorization) -sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" ${tmpfile} +sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" # If the gameserver uses anonymous steam credentials, leave them displayed # in the output. Otherwise, strip these out as well. if ! grep -q "^steampass[= ]\"\"" ${tmpfile} ; then - sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' ${tmpfile} + sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" fi if ! grep -q "^steamuser[= ]\"anonymous\"" ${tmpfile} ; then - sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' ${tmpfile} + sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi -if [ "$POSTTARGET" == "http://pastebin.com" ] ; then +if [ "$posttarget" == "http://pastebin.com" ] ; then # grab the return from 'value' from an initial visit to pastebin. - TOKEN=$(curl -s $POSTTARGET | + TOKEN=$(curl -s $posttarget | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') # # Use the TOKEN to then post the content. # - link=$(curl -s "$POSTTARGET/post.php" -D - -F "submit_hidden=submit_hidden" \ - -F "post_key=$TOKEN" -F "paste_expire_date=${POSTEXPIRE}" \ + link=$(curl -s "$posttarget/post.php" -D - -F "submit_hidden=submit_hidden" \ + -F "post_key=$TOKEN" -F "paste_expire_date=${postexpire}" \ -F "paste_name=${gamename} Debug Info" \ -F "paste_format=8" -F "paste_private=0" \ -F "paste_type=bash" -F "paste_code=<${tmpfile}" | awk '/^location: / { print $2 }' | sed "s/\n//g") # Output the resulting link. - fn_print_warn_nl "Visit (and verify) the content posted at ${POSTTARGET}${link}" -elif [ "$POSTTARGET" == "http://hastebin.com" ] ; then + fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}${link}" +elif [ "$posttarget" == "http://hastebin.com" ] ; then # hastebin is a bit simpler. If successful, the returned result # should look like: {"something":"key"}, putting the reference that # we need in "key". TODO - error handling. -CedarLUG - link=$(curl -s -d "$(<${tmpfile})" ${POSTTARGET}/documents| cut -d\" -f4) - fn_print_warn_nl "Visit (and verify) the content posted at ${POSTTARGET}/${link}" + link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) + fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}/${link}" else - fn_print_warn_nl "Review the output in ${tmpfile}" + fn_print_warn_nl Review the output in "${tmpfile}" core_exit.sh fi diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index d98c469d6..369b626a7 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -122,14 +122,14 @@ fn_fetch_function command_postdetails.sh(){ functionfile="${FUNCNAME}" - tempffname=$functionfile + tempffname="${functionfile}" # First, grab the command_postdetails.sh file fn_fetch_function # But then next, command_details.sh needs to also be pulled # because command_postdetails.sh sources its functions -CedarLUG functionfile="command_details.sh" fn_fetch_function - functionfile=$tempffname + functionfile="${tempffname}" } command_details.sh(){ From a33f5159fbb1fd3f58b53691994139e70d410817 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 14:44:15 -0500 Subject: [PATCH 15/22] Quote around directory --- lgsm/functions/command_postdetails.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index e9bd5f36c..dbf4fd772 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -45,7 +45,7 @@ postexpire="${postexpire="1W"}" # for the variable "postdetails" to be defined. -CedarLUG # source all of the functions defined in the details command -. ${functionsdir}/command_details.sh +. "${functionsdir}"/command_details.sh fn_bad_tmpfile() { echo "There was a problem creating a temporary file ${tmpfile}." From c8ac69ac672bacf08deb41d4e78c39ee42589fd3 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 14:49:30 -0500 Subject: [PATCH 16/22] More tidying up. --- lgsm/functions/command_postdetails.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index dbf4fd772..bfe935f54 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -108,15 +108,15 @@ if ! grep -q "^steamuser[= ]\"anonymous\"" ${tmpfile} ; then sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi -if [ "$posttarget" == "http://pastebin.com" ] ; then +if [ "${posttarget}" == "http://pastebin.com" ] ; then # grab the return from 'value' from an initial visit to pastebin. - TOKEN=$(curl -s $posttarget | + csrftoken=$(curl -s ${posttarget} | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') # - # Use the TOKEN to then post the content. + # Use the csrftoken to then post the content. # - link=$(curl -s "$posttarget/post.php" -D - -F "submit_hidden=submit_hidden" \ - -F "post_key=$TOKEN" -F "paste_expire_date=${postexpire}" \ + link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ + -F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \ -F "paste_name=${gamename} Debug Info" \ -F "paste_format=8" -F "paste_private=0" \ -F "paste_type=bash" -F "paste_code=<${tmpfile}" | @@ -124,7 +124,7 @@ if [ "$posttarget" == "http://pastebin.com" ] ; then # Output the resulting link. fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}${link}" -elif [ "$posttarget" == "http://hastebin.com" ] ; then +elif [ "${posttarget}" == "http://hastebin.com" ] ; then # hastebin is a bit simpler. If successful, the returned result # should look like: {"something":"key"}, putting the reference that # we need in "key". TODO - error handling. -CedarLUG @@ -136,6 +136,5 @@ else fi # cleanup -rm ${tmpfile} || /bin/true - +rm "${tmpfile}" || /bin/true core_exit.sh From 03a051c1c63652c0a5a70e520402748533c7b056 Mon Sep 17 00:00:00 2001 From: CedarLUG Date: Mon, 12 Sep 2016 14:52:45 -0500 Subject: [PATCH 17/22] Adding more quotes around vars. --- lgsm/functions/command_postdetails.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index bfe935f54..285831145 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -101,16 +101,16 @@ sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" # If the gameserver uses anonymous steam credentials, leave them displayed # in the output. Otherwise, strip these out as well. -if ! grep -q "^steampass[= ]\"\"" ${tmpfile} ; then +if ! grep -q "^steampass[= ]\"\"" "${tmpfile}" ; then sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" fi -if ! grep -q "^steamuser[= ]\"anonymous\"" ${tmpfile} ; then +if ! grep -q "^steamuser[= ]\"anonymous\"" "${tmpfile}" ; then sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi if [ "${posttarget}" == "http://pastebin.com" ] ; then # grab the return from 'value' from an initial visit to pastebin. - csrftoken=$(curl -s ${posttarget} | + csrftoken=$(curl -s "${posttarget}" | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') # # Use the csrftoken to then post the content. From 73a576955c70ca6e5219edfc291e07c63fa2ca25 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 14 Sep 2016 23:07:28 +0100 Subject: [PATCH 18/22] ${lgsmdir}/tmp has become ${tmpdir} --- 7DaysToDie/sdtdserver | 1 + ARKSurvivalEvolved/arkserver | 1 + Arma3/arma3server | 1 + Battlefield1942/bf1942server | 1 + BlackMesa/bmdmserver | 1 + BladeSymphony/bsserver | 1 + BrainBread2/bb2server | 1 + CodenameCURE/ccserver | 1 + CounterStrike/csserver | 1 + CounterStrikeConditionZero/csczserver | 1 + CounterStrikeGlobalOffensive/csgoserver | 1 + CounterStrikeSource/cssserver | 1 + DayOfDefeat/dodserver | 1 + DayOfDefeatSource/dodsserver | 1 + DayOfInfamy/doiserver | 1 + DeathmatchClassic/dmcserver | 1 + DontStarveTogether/dstserver | 1 + DoubleActionBoogaloo/dabserver | 1 + EmpiresMod/emserver | 1 + FistfulOfFrags/fofserver | 1 + GarrysMod/gmodserver | 1 + GoldenEyeSource/gesserver | 1 + HalfLife2Deathmatch/hl2dmserver | 1 + HalfLifeDeathmatch/hldmserver | 1 + HalfLifeDeathmatchSource/hldmsserver | 1 + Hurtworld/hwserver | 1 + Insurgency/insserver | 1 + JustCause2/jc2server | 1 + KillingFloor/kfserver | 1 + Left4Dead/l4dserver | 1 + Left4Dead2/l4d2server | 1 + Mumble/mumbleserver | 1 + NS2Combat/ns2cserver | 1 + NaturalSelection2/ns2server | 1 + NoMoreRoomInHell/nmrihserver | 1 + OpposingForce/opforserver | 1 + PiratesVikingandKnightsII/pvkiiserver | 1 + QuakeLive/qlserver | 1 + RedOrchestra/roserver | 1 + Ricochet/ricochetserver | 1 + Rust/rustserver | 1 + SeriousSam3BFE/ss3sserver | 1 + Starbound/sbserver | 1 + SvenCoop/svencoopserver | 1 + TeamFortress2/tf2server | 1 + TeamFortressClassic/tfcserver | 1 + TeamSpeak3/ts3server | 1 + Teeworlds/twserver | 1 + Terraria/terrariaserver | 1 + UnrealTournament/utserver | 1 + UnrealTournament2004/ut2k4server | 1 + UnrealTournament3/ut3server | 1 + UnrealTournament99/ut99server | 1 + WolfensteinEnemyTerritory/wetserver | 1 + lgsm/functions/check_steamcmd.sh | 4 +- lgsm/functions/command_dev_detect_deps.sh | 96 +++++++++++----------- lgsm/functions/command_dev_detect_glibc.sh | 6 +- lgsm/functions/command_dev_detect_ldd.sh | 18 ++-- lgsm/functions/command_postdetails.sh | 20 ++--- lgsm/functions/core_functions.sh | 12 ++- lgsm/functions/install_server_files.sh | 14 ++-- lgsm/functions/update_minecraft.sh | 4 +- lgsm/functions/update_mumble.sh | 6 +- lgsm/functions/update_ts3.sh | 21 ++--- tests/tests_jc2server.sh | 1 + tests/tests_ts3server.sh | 1 + 66 files changed, 157 insertions(+), 100 deletions(-) diff --git a/7DaysToDie/sdtdserver b/7DaysToDie/sdtdserver index 72a7bcaf8..7eca580bc 100644 --- a/7DaysToDie/sdtdserver +++ b/7DaysToDie/sdtdserver @@ -62,6 +62,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/ARKSurvivalEvolved/arkserver b/ARKSurvivalEvolved/arkserver index 58840fd0f..55b4f5d48 100644 --- a/ARKSurvivalEvolved/arkserver +++ b/ARKSurvivalEvolved/arkserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/ShooterGame" executabledir="${systemdir}/Binaries/Linux" diff --git a/Arma3/arma3server b/Arma3/arma3server index 70039ba37..61756bbf6 100644 --- a/Arma3/arma3server +++ b/Arma3/arma3server @@ -81,6 +81,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/Battlefield1942/bf1942server b/Battlefield1942/bf1942server index ba3f93587..ecc8d34f4 100644 --- a/Battlefield1942/bf1942server +++ b/Battlefield1942/bf1942server @@ -53,6 +53,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${systemdir}" diff --git a/BlackMesa/bmdmserver b/BlackMesa/bmdmserver index 9250d2a5b..955a473d9 100644 --- a/BlackMesa/bmdmserver +++ b/BlackMesa/bmdmserver @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/bms" executabledir="${filesdir}" diff --git a/BladeSymphony/bsserver b/BladeSymphony/bsserver index 4d9960123..bf652e27c 100644 --- a/BladeSymphony/bsserver +++ b/BladeSymphony/bsserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/berimbau" executabledir="${filesdir}" diff --git a/BrainBread2/bb2server b/BrainBread2/bb2server index 669be4e11..e07d4f748 100644 --- a/BrainBread2/bb2server +++ b/BrainBread2/bb2server @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/brainbread2" executabledir="${filesdir}" diff --git a/CodenameCURE/ccserver b/CodenameCURE/ccserver index 7abd395cf..18616fcce 100644 --- a/CodenameCURE/ccserver +++ b/CodenameCURE/ccserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cure" executabledir="${filesdir}" diff --git a/CounterStrike/csserver b/CounterStrike/csserver index 977a06225..0eab77999 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" diff --git a/CounterStrikeConditionZero/csczserver b/CounterStrikeConditionZero/csczserver index 2b0ff70dd..69782958f 100644 --- a/CounterStrikeConditionZero/csczserver +++ b/CounterStrikeConditionZero/csczserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/czero" executabledir="${filesdir}" diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver index c409c279b..5502d5f0e 100755 --- a/CounterStrikeGlobalOffensive/csgoserver +++ b/CounterStrikeGlobalOffensive/csgoserver @@ -95,6 +95,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/csgo" executabledir="${filesdir}" diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index edd7a7c08..4374586fc 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" diff --git a/DayOfDefeat/dodserver b/DayOfDefeat/dodserver index 12168ee28..ee3342908 100644 --- a/DayOfDefeat/dodserver +++ b/DayOfDefeat/dodserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index 545b0a50d..7fc78db9d 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" diff --git a/DayOfInfamy/doiserver b/DayOfInfamy/doiserver index b8641bc87..b3a19f4d1 100644 --- a/DayOfInfamy/doiserver +++ b/DayOfInfamy/doiserver @@ -69,6 +69,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/doi" executabledir="${filesdir}" diff --git a/DeathmatchClassic/dmcserver b/DeathmatchClassic/dmcserver index 654072aa5..68bd720f6 100644 --- a/DeathmatchClassic/dmcserver +++ b/DeathmatchClassic/dmcserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dmc" executabledir="${filesdir}" diff --git a/DontStarveTogether/dstserver b/DontStarveTogether/dstserver index e9ecfbd05..1d7f571be 100644 --- a/DontStarveTogether/dstserver +++ b/DontStarveTogether/dstserver @@ -65,6 +65,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}/bin" diff --git a/DoubleActionBoogaloo/dabserver b/DoubleActionBoogaloo/dabserver index 41e3d4cd8..9ee35ceae 100644 --- a/DoubleActionBoogaloo/dabserver +++ b/DoubleActionBoogaloo/dabserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dab" executabledir="${filesdir}" diff --git a/EmpiresMod/emserver b/EmpiresMod/emserver index 3d51fbff7..5fbd9ba4e 100644 --- a/EmpiresMod/emserver +++ b/EmpiresMod/emserver @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/empires" executabledir="${filesdir}" diff --git a/FistfulOfFrags/fofserver b/FistfulOfFrags/fofserver index 1f263eee2..a5576bff5 100644 --- a/FistfulOfFrags/fofserver +++ b/FistfulOfFrags/fofserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/fof" executabledir="${filesdir}" diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver index 7c9179c4b..c47e6e1d1 100644 --- a/GarrysMod/gmodserver +++ b/GarrysMod/gmodserver @@ -88,6 +88,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/garrysmod" addonsdir="${systemdir}/addons" diff --git a/GoldenEyeSource/gesserver b/GoldenEyeSource/gesserver index 641258936..b80f2848f 100644 --- a/GoldenEyeSource/gesserver +++ b/GoldenEyeSource/gesserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/gesource" executabledir="${filesdir}" diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index df2a3060b..6169474dc 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/hl2mp" executabledir="${filesdir}" diff --git a/HalfLifeDeathmatch/hldmserver b/HalfLifeDeathmatch/hldmserver index 57a414f1f..6cef66c32 100644 --- a/HalfLifeDeathmatch/hldmserver +++ b/HalfLifeDeathmatch/hldmserver @@ -66,6 +66,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/valve" executabledir="${filesdir}" diff --git a/HalfLifeDeathmatchSource/hldmsserver b/HalfLifeDeathmatchSource/hldmsserver index 7e847fa12..947a34a5c 100644 --- a/HalfLifeDeathmatchSource/hldmsserver +++ b/HalfLifeDeathmatchSource/hldmsserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/hl1mp" executabledir="${filesdir}" diff --git a/Hurtworld/hwserver b/Hurtworld/hwserver index 34728b3c8..5b6bffb94 100644 --- a/Hurtworld/hwserver +++ b/Hurtworld/hwserver @@ -81,6 +81,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/Insurgency/insserver b/Insurgency/insserver index ae7937733..90e17d7a4 100644 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -69,6 +69,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/insurgency" executabledir="${filesdir}" diff --git a/JustCause2/jc2server b/JustCause2/jc2server index 1c97e6a4d..021200d30 100644 --- a/JustCause2/jc2server +++ b/JustCause2/jc2server @@ -61,6 +61,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver index 40f35d77c..c621102ca 100644 --- a/KillingFloor/kfserver +++ b/KillingFloor/kfserver @@ -66,6 +66,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" diff --git a/Left4Dead/l4dserver b/Left4Dead/l4dserver index a19ea6582..1569730ef 100644 --- a/Left4Dead/l4dserver +++ b/Left4Dead/l4dserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/left4dead" executabledir="${filesdir}" diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index 7d38cd071..4df0151d7 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -66,6 +66,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/left4dead2" executabledir="${filesdir}" diff --git a/Mumble/mumbleserver b/Mumble/mumbleserver index ba7db3da3..ab071d7dc 100644 --- a/Mumble/mumbleserver +++ b/Mumble/mumbleserver @@ -54,6 +54,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/NS2Combat/ns2cserver b/NS2Combat/ns2cserver index 559511eec..e96e57cc0 100644 --- a/NS2Combat/ns2cserver +++ b/NS2Combat/ns2cserver @@ -74,6 +74,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}/ia32" diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index 94320f0da..a84fba2e3 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -79,6 +79,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver index 0a68e2812..a8818a416 100644 --- a/NoMoreRoomInHell/nmrihserver +++ b/NoMoreRoomInHell/nmrihserver @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/nmrih" executabledir="${filesdir}" diff --git a/OpposingForce/opforserver b/OpposingForce/opforserver index 58f72e481..7ddaef575 100644 --- a/OpposingForce/opforserver +++ b/OpposingForce/opforserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/gearbox" executabledir="${filesdir}" diff --git a/PiratesVikingandKnightsII/pvkiiserver b/PiratesVikingandKnightsII/pvkiiserver index 5abecfa19..7b5c28b9a 100644 --- a/PiratesVikingandKnightsII/pvkiiserver +++ b/PiratesVikingandKnightsII/pvkiiserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/pvkii" executabledir="${filesdir}" diff --git a/QuakeLive/qlserver b/QuakeLive/qlserver index 19b27b27e..9fc6ef5a4 100755 --- a/QuakeLive/qlserver +++ b/QuakeLive/qlserver @@ -70,6 +70,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index 1d0a39341..d64c25994 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -62,6 +62,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/system" executabledir="${systemdir}" diff --git a/Ricochet/ricochetserver b/Ricochet/ricochetserver index 68664448f..bab26ea44 100644 --- a/Ricochet/ricochetserver +++ b/Ricochet/ricochetserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/ricochet" executabledir="${filesdir}" diff --git a/Rust/rustserver b/Rust/rustserver index afe0c662a..27cb6b03f 100644 --- a/Rust/rustserver +++ b/Rust/rustserver @@ -84,6 +84,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/SeriousSam3BFE/ss3sserver b/SeriousSam3BFE/ss3sserver index 7302c282b..38c70a30d 100644 --- a/SeriousSam3BFE/ss3sserver +++ b/SeriousSam3BFE/ss3sserver @@ -62,6 +62,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/Bin" executable="./runSam3_DedicatedServer.sh" diff --git a/Starbound/sbserver b/Starbound/sbserver index 3ad6afdf9..87880fd2e 100644 --- a/Starbound/sbserver +++ b/Starbound/sbserver @@ -61,6 +61,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}/linux" diff --git a/SvenCoop/svencoopserver b/SvenCoop/svencoopserver index 1043cdfd3..f59d3c81b 100644 --- a/SvenCoop/svencoopserver +++ b/SvenCoop/svencoopserver @@ -66,6 +66,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/svencoop" executabledir="${filesdir}" diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index 335af8b4a..133c8ac6d 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -72,6 +72,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tf" executabledir="${filesdir}" diff --git a/TeamFortressClassic/tfcserver b/TeamFortressClassic/tfcserver index 53455703e..78713c9a0 100644 --- a/TeamFortressClassic/tfcserver +++ b/TeamFortressClassic/tfcserver @@ -67,6 +67,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tfc" executabledir="${filesdir}" diff --git a/TeamSpeak3/ts3server b/TeamSpeak3/ts3server index 1e7ad5952..dd36fb31f 100644 --- a/TeamSpeak3/ts3server +++ b/TeamSpeak3/ts3server @@ -40,6 +40,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/Teeworlds/twserver b/Teeworlds/twserver index cd81024c0..417eacae4 100644 --- a/Teeworlds/twserver +++ b/Teeworlds/twserver @@ -62,6 +62,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 9dd94a0f5..a4a4ef876 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -62,6 +62,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/UnrealTournament/utserver b/UnrealTournament/utserver index f7e5e2981..29bf40e0c 100644 --- a/UnrealTournament/utserver +++ b/UnrealTournament/utserver @@ -59,6 +59,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/LinuxServer" executabledir="${systemdir}/Engine/Binaries/Linux" diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index 4eec3e473..15e1f1a06 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -45,6 +45,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" diff --git a/UnrealTournament3/ut3server b/UnrealTournament3/ut3server index 97f768974..aeb2c7241 100644 --- a/UnrealTournament3/ut3server +++ b/UnrealTournament3/ut3server @@ -57,6 +57,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${systemdir}/Binaries" diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index aa4dc9339..91e5e46fb 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -54,6 +54,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" diff --git a/WolfensteinEnemyTerritory/wetserver b/WolfensteinEnemyTerritory/wetserver index 86f4f0839..a3d5422eb 100644 --- a/WolfensteinEnemyTerritory/wetserver +++ b/WolfensteinEnemyTerritory/wetserver @@ -52,6 +52,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${systemdir}" diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 1e0f66cd7..06e941ff4 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -10,8 +10,8 @@ fn_install_steamcmd(){ if [ ! -d "${steamcmddir}" ]; then mkdir -v "${steamcmddir}" fi - fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${lgsmdir}/tmp" "steamcmd_linux.tar.gz" - fn_dl_extract "${lgsmdir}/tmp" "steamcmd_linux.tar.gz" "${steamcmddir}" + fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" + fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" chmod +x "${steamcmddir}/steamcmd.sh" } diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh index d5d556c6b..01c96ff47 100644 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/functions/command_dev_detect_deps.sh @@ -42,62 +42,62 @@ else echo "readelf/eu-readelf not installed" fi -${readelf} -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > "${lgsmdir}/tmp/.depdetect_readelf" +${readelf} -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > "${tmpdir}/.depdetect_readelf" -echo "yum install " > "${lgsmdir}/tmp/.depdetect_centos_list_uniq" -echo "apt-get install " > "${lgsmdir}/tmp/.depdetect_ubuntu_list_uniq" -echo "apt-get install " > "${lgsmdir}/tmp/.depdetect_debian_list_uniq" +echo "yum install " > "${tmpdir}/.depdetect_centos_list_uniq" +echo "apt-get install " > "${tmpdir}/.depdetect_ubuntu_list_uniq" +echo "apt-get install " > "${tmpdir}/.depdetect_debian_list_uniq" while read lib; do sharedlib=${lib} if [ "${lib}" == "libm.so.6" ]||[ "${lib}" == "libc.so.6" ]||[ "${lib}" == "libpthread.so.0" ]||[ "${lib}" == "libdl.so.2" ]||[ "${lib}" == "libnsl.so.1" ]||[ "${lib}" == "libgcc_s.so.1" ]||[ "${lib}" == "librt.so.1" ]||[ "${lib}" == "ld-linux.so.2" ]; then - echo "glibc.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "lib32gcc1" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "lib32gcc1" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "glibc.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "lib32gcc1" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "lib32gcc1" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "libstdc++.so.6" ]; then - echo "libstdc++.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "libstdc++6:i386" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "libstdc++6:i386" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "libstdc++.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "libstdc++6:i386" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "libstdc++6:i386" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "libstdc++.so.5" ]; then - echo "compat-libstdc++-33.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "libstdc++5:i386" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "libstdc++5:i386" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "compat-libstdc++-33.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "libstdc++5:i386" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "libstdc++5:i386" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then - echo "speex.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "speex:i386" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "speex:i386" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "speex.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "speex:i386" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "speex:i386" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "./libSDL-1.2.so.0" ]||[ "${lib}" == "libSDL-1.2.so.0" ]; then - echo "SDL.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "libsdl1.2debian" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "libsdl1.2debian" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "SDL.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "libsdl1.2debian" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "libsdl1.2debian" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "libtbb.so.2" ]; then - echo "tbb.i686" >> "${lgsmdir}/tmp/.depdetect_centos_list" - echo "libtbb2" >> "${lgsmdir}/tmp/.depdetect_ubuntu_list" - echo "libtbb2" >> "${lgsmdir}/tmp/.depdetect_debian_list" + echo "tbb.i686" >> "${tmpdir}/.depdetect_centos_list" + echo "libtbb2" >> "${tmpdir}/.depdetect_ubuntu_list" + echo "libtbb2" >> "${tmpdir}/.depdetect_debian_list" elif [ "${lib}" == "libtier0.so" ]||[ "${lib}" == "Core.so" ]||[ "${lib}" == "Editor.so" ]||[ "${lib}" == "Engine.so" ]||[ "${lib}" == "liblua.so" ]||[ "${lib}" == "libsteam_api.so" ]||[ "${lib}" == "ld-linux-x86-64.so.2" ]||[ "${lib}" == "libPhysX3_x86.so" ]||[ "${lib}" == "libPhysX3Common_x86.so" ]||[ "${lib}" == "libPhysX3Cooking_x86.so" ]; then # Known shared libs what dont requires dependencies : else unknownlib=1 - echo "${lib}" >> "${lgsmdir}/tmp/.depdetect_unknown" + echo "${lib}" >> "${tmpdir}/.depdetect_unknown" fi -done < "${lgsmdir}/tmp/.depdetect_readelf" -sort "${lgsmdir}/tmp/.depdetect_centos_list" | uniq >> "${lgsmdir}/tmp/.depdetect_centos_list_uniq" -sort "${lgsmdir}/tmp/.depdetect_ubuntu_list" | uniq >> "${lgsmdir}/tmp/.depdetect_ubuntu_list_uniq" -sort "${lgsmdir}/tmp/.depdetect_debian_list" | uniq >> "${lgsmdir}/tmp/.depdetect_debian_list_uniq" +done < "${tmpdir}/.depdetect_readelf" +sort "${tmpdir}/.depdetect_centos_list" | uniq >> "${tmpdir}/.depdetect_centos_list_uniq" +sort "${tmpdir}/.depdetect_ubuntu_list" | uniq >> "${tmpdir}/.depdetect_ubuntu_list_uniq" +sort "${tmpdir}/.depdetect_debian_list" | uniq >> "${tmpdir}/.depdetect_debian_list_uniq" if [ "${unknownlib}" == "1" ]; then - sort "${lgsmdir}/tmp/.depdetect_unknown" | uniq >> "${lgsmdir}/tmp/.depdetect_unknown_uniq" + sort "${tmpdir}/.depdetect_unknown" | uniq >> "${tmpdir}/.depdetect_unknown_uniq" fi -awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/tmp/.depdetect_centos_list_uniq" > "${lgsmdir}/tmp/.depdetect_centos_line" -awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/tmp/.depdetect_ubuntu_list_uniq" > "${lgsmdir}/tmp/.depdetect_ubuntu_line" -awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/tmp/.depdetect_debian_list_uniq" > "${lgsmdir}/tmp/.depdetect_debian_line" +awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_centos_list_uniq" > "${tmpdir}/.depdetect_centos_line" +awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_ubuntu_list_uniq" > "${tmpdir}/.depdetect_ubuntu_line" +awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_debian_list_uniq" > "${tmpdir}/.depdetect_debian_line" echo "" echo "Required Dependencies" @@ -106,46 +106,46 @@ echo "${executable}" echo "" echo "CentOS" echo "=================================" -cat "${lgsmdir}/tmp/.depdetect_centos_line" +cat "${tmpdir}/.depdetect_centos_line" echo "" echo "" echo "Ubuntu" echo "=================================" -cat "${lgsmdir}/tmp/.depdetect_ubuntu_line" +cat "${tmpdir}/.depdetect_ubuntu_line" echo "" echo "" echo "Debian" echo "=================================" -cat "${lgsmdir}/tmp/.depdetect_debian_line" +cat "${tmpdir}/.depdetect_debian_line" echo "" if [ "${unknownlib}" == "1" ]; then echo "" echo "Unknown shared Library" echo "=================================" - cat "${lgsmdir}/tmp/.depdetect_unknown" + cat "${tmpdir}/.depdetect_unknown" fi echo "" echo "Required Librarys" echo "=================================" -sort "${lgsmdir}/tmp/.depdetect_readelf" |uniq +sort "${tmpdir}/.depdetect_readelf" |uniq echo "" echo "ldd" echo "=================================" ldd ${executable} echo -en "\n" -rm -f "${lgsmdir}/tmp/.depdetect_centos_line" -rm -f "${lgsmdir}/tmp/.depdetect_centos_list" -rm -f "${lgsmdir}/tmp/.depdetect_centos_list_uniq" +rm -f "${tmpdir}/.depdetect_centos_line" +rm -f "${tmpdir}/.depdetect_centos_list" +rm -f "${tmpdir}/.depdetect_centos_list_uniq" -rm -f "${lgsmdir}/tmp/.depdetect_debian_line" -rm -f "${lgsmdir}/tmp/.depdetect_debian_list" -rm -f "${lgsmdir}/tmp/.depdetect_debian_list_uniq" +rm -f "${tmpdir}/.depdetect_debian_line" +rm -f "${tmpdir}/.depdetect_debian_list" +rm -f "${tmpdir}/.depdetect_debian_list_uniq" -rm -f "${lgsmdir}/tmp/.depdetect_ubuntu_line" -rm -f "${lgsmdir}/tmp/.depdetect_ubuntu_list" -rm -f "${lgsmdir}/tmp/.depdetect_ubuntu_list_uniq" +rm -f "${tmpdir}/.depdetect_ubuntu_line" +rm -f "${tmpdir}/.depdetect_ubuntu_list" +rm -f "${tmpdir}/.depdetect_ubuntu_list_uniq" -rm -f "${lgsmdir}/tmp/.depdetect_readelf" +rm -f "${tmpdir}/.depdetect_readelf" -rm -f "${lgsmdir}/tmp/.depdetect_unknown" -rm -f "${lgsmdir}/tmp/.depdetect_unknown_uniq" \ No newline at end of file +rm -f "${tmpdir}/.depdetect_unknown" +rm -f "${tmpdir}/.depdetect_unknown_uniq" \ No newline at end of file diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index c039e44cb..7c247f888 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -25,10 +25,10 @@ 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" + objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/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" \ No newline at end of file +cat "${tmpdir}/detect_glibc.tmp"|sort|uniq|sort -r --version-sort +rm "${tmpdir}/detect_glibc.tmp" \ No newline at end of file diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh index b9be9386a..07ad3f581 100644 --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/functions/command_dev_detect_ldd.sh @@ -25,14 +25,14 @@ 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" + #ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/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" + echo "$line" >> "${tmpdir}/detect_ldd.tmp" + ldd $line 2>/dev/null |grep -v "not a dynamic executable" >> "${tmpdir}/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" + echo "$line" >> "${tmpdir}/detect_ldd_not_found.tmp" + ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp" fi fi echo -n "$i / $files" $'\r' @@ -42,12 +42,12 @@ echo "" echo "" echo "All" echo "=================================" -cat "${lgsmdir}/tmp/detect_ldd.tmp" +cat "${tmpdir}/detect_ldd.tmp" echo "" echo "Not Found" echo "=================================" -cat "${lgsmdir}/tmp/detect_ldd_not_found.tmp" +cat "${tmpdir}/detect_ldd_not_found.tmp" -rm "${lgsmdir}/tmp/detect_ldd.tmp" -rm "${lgsmdir}/tmp/detect_ldd_not_found.tmp" \ No newline at end of file +rm "${tmpdir}/detect_ldd.tmp" +rm "${tmpdir}/detect_ldd_not_found.tmp" \ No newline at end of file diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 285831145..3504fcbd2 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -13,14 +13,14 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" # it here silences the output from sourcing command_details.sh. postdetails=yes -# Set posttarget to the appropriately-defined post destination. - +# Set posttarget to the appropriately-defined post destination. + # The options for posttarget are: -# The default destination - hastebin +# The default destination - hastebin # posttarget="http://hastebin.com" # # Secondary destination - pastebin -# posttarget="http://hastebin.com +# posttarget="http://pastebin.com # # Third option - leave on the filesystem # posttarget= @@ -36,7 +36,7 @@ posttarget=${posttarget="http://hastebin.com"} # For pastebin, you can set the expiration period. # use 1 week as the default, other options are '24h' for a day, etc. # This, too, may be overridden from the command line at the top-level -postexpire="${postexpire="1W"}" +postexpire="${postexpire="1W"}" # This file sources the command_details.sh file to leverage all # of the already-defined functions. To keep the command_details.sh @@ -53,7 +53,7 @@ fn_bad_tmpfile() { } # Rather than a one-pass sed parser, default to using a temporary directory -posttmpdir="${lgsmdir}/tmp" +posttmpdir="${tmpdir}" # Not all game servers possess a tmp directory. So create it if # it doesn't already exist @@ -63,7 +63,7 @@ tmpfile="${posttmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp" touch "${tmpfile}" || fn_bad_tmpfile -# fn_display_details is found in the command_details.sh file (which +# fn_display_details is found in the command_details.sh file (which # was sourced above). The output is parsed for passwords and other # confidential information. -CedarLUG @@ -108,11 +108,11 @@ if ! grep -q "^steamuser[= ]\"anonymous\"" "${tmpfile}" ; then sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi -if [ "${posttarget}" == "http://pastebin.com" ] ; then +if [ "${posttarget}" == "http://pastebin.com" ] ; then # grab the return from 'value' from an initial visit to pastebin. csrftoken=$(curl -s "${posttarget}" | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') - # + # # Use the csrftoken to then post the content. # link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ @@ -131,7 +131,7 @@ elif [ "${posttarget}" == "http://hastebin.com" ] ; then link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}/${link}" else - fn_print_warn_nl Review the output in "${tmpfile}" + fn_print_warn_nl Review the output in "${tmpfile}" core_exit.sh fi diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 369b626a7..06625d849 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -18,7 +18,7 @@ if [ "${emailnotification}" == "on" ]; then emailalert="on" fi -# Code/functions for legacy servers +## Code/functions for legacy servers fn_functions(){ functionfile="${FUNCNAME}" fn_fetch_function @@ -29,13 +29,15 @@ functionfile="${FUNCNAME}" fn_fetch_function } -# fn_fetch_core_dl also placed here to allow legacy servers to still download core functions -if [ -z "${lgsmdir}" ]||[ -z "${functionsdir}" ]||[ -z "${libdir}" ]; then +## In case older versions are missing these vars +if [ -z "${lgsmdir}" ]||[ -z "${functionsdir}" ]||[ -z "${libdir}" ]||[ -z "${tmpdir}" ]; then lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" + tmpdir="${tmpdir}" fi +## fn_fetch_core_dl placed here to allow legacy servers to still download core functions fn_fetch_core_dl(){ github_file_url_dir="lgsm/functions" github_file_url_name="${functionfile}" @@ -78,6 +80,10 @@ fi source "${filedir}/${filename}" } +# Creates tmp dir if missing +if [ ! -d "${tmpdir}" ]; then + mkdir -p "${tmpdir}" +fi # Core diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 65f32c134..e1b140bb8 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -10,19 +10,19 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_install_server_files(){ if [ "${gamename}" == "Unreal Tournament 99" ]; then - fileurl="http://files.gameservermanagers.com/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd" + fileurl="http://files.gameservermanagers.com/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${tmpdir}"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd" elif [ "${gamename}" == "Unreal Tournament 2004" ]; then - fileurl="http://files.gameservermanagers.com/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut2004-server-3339-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54" + fileurl="http://files.gameservermanagers.com/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${tmpdir}"; filename="ut2004-server-3339-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54" elif [ "${gamename}" == "Unreal Tournament 3" ]; then - fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="UT3-linux-server-2.1.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="6c22fcef9e2e03ed154df97569af540c" + fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; filedir="${tmpdir}"; filename="UT3-linux-server-2.1.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="6c22fcef9e2e03ed154df97569af540c" elif [ "${gamename}" == "Battlefield: 1942" ]; then - fileurl="http://files.gameservermanagers.com/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz"; filedir="${lgsmdir}/tmp"; filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz"; executecmd="noexecute" run="norun"; force="noforce"; md5="7e9d2538a62b228f2de7176b44659aa9" + fileurl="http://files.gameservermanagers.com/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz"; filedir="${tmpdir}"; filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz"; executecmd="noexecute" run="norun"; force="noforce"; md5="7e9d2538a62b228f2de7176b44659aa9" elif [ "${gamename}" == "Enemy Territory" ]; then - fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="enemy-territory.260b.tar.gz"; executecmd="noexecute" run="norun"; force="noforce"; md5="ded32053e470fe15d9403ec4a0ab7e89" + fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; filedir="${tmpdir}"; filename="enemy-territory.260b.tar.gz"; executecmd="noexecute" run="norun"; force="noforce"; md5="ded32053e470fe15d9403ec4a0ab7e89" 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" + fileurl="http://files.gameservermanagers.com/UnrealTournament/UnrealTournament-Server-XAN-3045522-Linux.zip"; filedir="${tmpdir}"; 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="ea227a150300abe346e757380325f84c" + fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${tmpdir}"; 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}" diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index f4e140d6e..717e798cd 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -9,10 +9,10 @@ local commandaction="Update" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_update_dl(){ - fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${lgsmdir}/tmp" "minecraft_server.${availablebuild}.jar" + fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar" echo -e "copying to ${filesdir}...\c" fn_script_log "Copying to ${filesdir}" - cp "${lgsmdir}/tmp/minecraft_server.${availablebuild}.jar" "${filesdir}/minecraft_server.jar" + cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${filesdir}/minecraft_server.jar" local exitcode=$? if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 0a90384f7..338ad4545 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -10,11 +10,11 @@ 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" + fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" + fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" echo -e "copying to ${filesdir}...\c" fn_script_log "Copying to ${filesdir}" - cp -R "${lgsmdir}/tmp/murmur-static_${mumblearch}-${availablebuild}/"* "${filesdir}" + cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${filesdir}" local exitcode=$? if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 6dfdced1a..5e897f7b9 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -9,11 +9,11 @@ local commandaction="Update" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_update_ts3_dl(){ - fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${lgsmdir}/tmp" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" - fn_dl_extract "${lgsmdir}/tmp" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${lgsmdir}/tmp" + fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" + fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" echo -e "copying to ${filesdir}...\c" fn_script_log "Copying to ${filesdir}" - cp -R "${lgsmdir}/tmp/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" + cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" local exitcode=$? if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl @@ -86,16 +86,11 @@ fi fn_update_ts3_availablebuild(){ # Gets latest build info. - # 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>' | egrep -o '[0-9\.?]+'|uniq > "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" + wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > "${tmpdir}/.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" + cat "${tmpdir}/.ts3_version_numbers_unsorted.tmp" | sort -r --version-sort -o "${tmpdir}/.ts3_version_numbers_sorted.tmp" # Finds directory with most recent server version. while read ts3_version_number; do @@ -105,11 +100,11 @@ fn_update_ts3_availablebuild(){ # Break while-loop, if the latest release could be found. break fi - done < "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp" + done < "${tmpdir}/.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" + rm -f "${tmpdir}/.ts3_version_numbers_unsorted.tmp" + rm -f "${tmpdir}/.ts3_version_numbers_sorted.tmp" # Checks availablebuild info is available if [ -z "${availablebuild}" ]; then diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index c5f69f734..f2157e54a 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -60,6 +60,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index fb416d633..d62cf4e76 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -53,6 +53,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" From 0f39f6a357f7727e1fa4c079bd863fd38911235f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 14 Sep 2016 23:12:02 +0100 Subject: [PATCH 19/22] tmpdir --- ProjectZomboid/pzserver | 1 + lgsm/functions/command_postdetails.sh | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectZomboid/pzserver b/ProjectZomboid/pzserver index c07be1e49..e3f4f2df6 100644 --- a/ProjectZomboid/pzserver +++ b/ProjectZomboid/pzserver @@ -66,6 +66,7 @@ lockselfname=".${servicename}.lock" lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" +tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 3504fcbd2..c6a97afc3 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -53,13 +53,12 @@ fn_bad_tmpfile() { } # Rather than a one-pass sed parser, default to using a temporary directory -posttmpdir="${tmpdir}" # Not all game servers possess a tmp directory. So create it if # it doesn't already exist -mkdir -p "${posttmpdir}" 2>&1 >/dev/null +mkdir -p "${tmpdir}" 2>&1 >/dev/null -tmpfile="${posttmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp" +tmpfile="${tmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp" touch "${tmpfile}" || fn_bad_tmpfile From 68fe0c9e9db7f1910761b0f61b3318eedbd34a83 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 14 Sep 2016 23:13:56 +0100 Subject: [PATCH 20/22] corrected tmpdir --- lgsm/functions/core_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 06625d849..388846276 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -34,7 +34,7 @@ if [ -z "${lgsmdir}" ]||[ -z "${functionsdir}" ]||[ -z "${libdir}" ]||[ -z "${tm lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" - tmpdir="${tmpdir}" + tmpdir="${lgsmdir}/tmp" fi ## fn_fetch_core_dl placed here to allow legacy servers to still download core functions From d3c4eef230a6ce5daa99206e9fe59394ded1b89d Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 14 Sep 2016 23:40:43 +0100 Subject: [PATCH 21/22] changed to tabs and messages updates we use tabs here not spaces. updated post messages. requires more error checking --- lgsm/functions/command_postdetails.sh | 109 ++++++++++++++------------ 1 file changed, 58 insertions(+), 51 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index c6a97afc3..6a622e2eb 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -31,7 +31,7 @@ postdetails=yes # to post to pastebin, or # rustserver@gamerig:~$ posttarget= ./rustserver pd # to leave the output on the filesystem. -posttarget=${posttarget="http://hastebin.com"} +posttarget=${posttarget="http://pastebin.com"} # For pastebin, you can set the expiration period. # use 1 week as the default, other options are '24h' for a day, etc. @@ -45,19 +45,19 @@ postexpire="${postexpire="1W"}" # for the variable "postdetails" to be defined. -CedarLUG # source all of the functions defined in the details command -. "${functionsdir}"/command_details.sh +command_details.sh + +# redefine as command_details.sh changes them +local commandname="postdetails" +local commandaction="Postdetails" +local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_bad_tmpfile() { - echo "There was a problem creating a temporary file ${tmpfile}." - core_exit.sh + echo "There was a problem creating a temporary file ${tmpfile}." + core_exit.sh } # Rather than a one-pass sed parser, default to using a temporary directory - -# Not all game servers possess a tmp directory. So create it if -# it doesn't already exist -mkdir -p "${tmpdir}" 2>&1 >/dev/null - tmpfile="${tmpdir}/postdetails-$(date +"%Y-%d-%m_%H-%M-%S").tmp" touch "${tmpfile}" || fn_bad_tmpfile @@ -72,28 +72,28 @@ touch "${tmpfile}" || fn_bad_tmpfile # (This was originally a sed one-liner.) -CedarLUG fn_display_details | sed -e 's/password="[^"]*/password="--stripped--/' | - sed -e 's/password "[^"]*/password "--stripped--/' | - sed -e 's/password: .*/password: --stripped--/' | - sed -e 's/gslt="[^"]*/gslt="--stripped--/' | - sed -e 's/gslt "[^"]*/gslt "--stripped--/' | - sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' | - sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' | - sed -e 's/authkey="[^"]*/authkey="--stripped--/' | - sed -e 's/authkey "[^"]*/authkey "--stripped--/' | - sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' | - sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' | - sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' | - sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' | - sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' | - sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' | - sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' | - sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' | - sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' | - sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' | - sed -e 's/pass="[^"]*/pass="--stripped--/' | - sed -e 's/pass "[^"]*/pass "--stripped--/' | - sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | - sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > "${tmpfile}" + sed -e 's/password "[^"]*/password "--stripped--/' | + sed -e 's/password: .*/password: --stripped--/' | + sed -e 's/gslt="[^"]*/gslt="--stripped--/' | + sed -e 's/gslt "[^"]*/gslt "--stripped--/' | + sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' | + sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' | + sed -e 's/authkey="[^"]*/authkey="--stripped--/' | + sed -e 's/authkey "[^"]*/authkey "--stripped--/' | + sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' | + sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' | + sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' | + sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' | + sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' | + sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' | + sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' | + sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' | + sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' | + sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' | + sed -e 's/pass="[^"]*/pass="--stripped--/' | + sed -e 's/pass "[^"]*/pass "--stripped--/' | + sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | + sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > "${tmpfile}" # strip off all console escape codes (colorization) sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" @@ -101,34 +101,41 @@ sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" # If the gameserver uses anonymous steam credentials, leave them displayed # in the output. Otherwise, strip these out as well. if ! grep -q "^steampass[= ]\"\"" "${tmpfile}" ; then - sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" + sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" fi if ! grep -q "^steamuser[= ]\"anonymous\"" "${tmpfile}" ; then - sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" + sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi + if [ "${posttarget}" == "http://pastebin.com" ] ; then - # grab the return from 'value' from an initial visit to pastebin. - csrftoken=$(curl -s "${posttarget}" | - sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') - # - # Use the csrftoken to then post the content. - # - link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ - -F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \ - -F "paste_name=${gamename} Debug Info" \ - -F "paste_format=8" -F "paste_private=0" \ - -F "paste_type=bash" -F "paste_code=<${tmpfile}" | - awk '/^location: / { print $2 }' | sed "s/\n//g") + fn_print_dots "Posting details to pastbin.com for ${postexpire}" + sleep 1 + # grab the return from 'value' from an initial visit to pastebin. + csrftoken=$(curl -s "${posttarget}" | + sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') + # + # Use the csrftoken to then post the content. + # + link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ + -F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \ + -F "paste_name=${gamename} Debug Info" \ + -F "paste_format=8" -F "paste_private=0" \ + -F "paste_type=bash" -F "paste_code=<${tmpfile}" | + awk '/^location: / { print $2 }' | sed "s/\n//g") # Output the resulting link. - fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}${link}" + fn_print_ok_nl "Posting details to pastbin.com for ${postexpire}" + echo " * url: ${posttarget}/${link}" elif [ "${posttarget}" == "http://hastebin.com" ] ; then - # hastebin is a bit simpler. If successful, the returned result - # should look like: {"something":"key"}, putting the reference that - # we need in "key". TODO - error handling. -CedarLUG - link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) - fn_print_warn_nl "Visit (and verify) the content posted at ${posttarget}/${link}" + fn_print_dots "Posting details to hastbin.com for ${postexpire}" + sleep 1 + # hastebin is a bit simpler. If successful, the returned result + # should look like: {"something":"key"}, putting the reference that + # we need in "key". TODO - error handling. -CedarLUG + link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) + fn_print_ok_nl "Posting details to hastbin.com for ${postexpire}" + echo " * url: ${posttarget}/${link}" else fn_print_warn_nl Review the output in "${tmpfile}" core_exit.sh From c44874539a1fa60fa47d6262543a3ff7cca967b6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 24 Sep 2016 23:31:25 +0100 Subject: [PATCH 22/22] converted to tabs --- lgsm/functions/command_postdetails.sh | 110 +++++++++++++------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 6a622e2eb..fe46a251f 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -31,7 +31,7 @@ postdetails=yes # to post to pastebin, or # rustserver@gamerig:~$ posttarget= ./rustserver pd # to leave the output on the filesystem. -posttarget=${posttarget="http://pastebin.com"} +posttarget=${posttarget="http://hastebin.com"} # For pastebin, you can set the expiration period. # use 1 week as the default, other options are '24h' for a day, etc. @@ -53,8 +53,8 @@ local commandaction="Postdetails" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_bad_tmpfile() { - echo "There was a problem creating a temporary file ${tmpfile}." - core_exit.sh + echo "There was a problem creating a temporary file ${tmpfile}." + core_exit.sh } # Rather than a one-pass sed parser, default to using a temporary directory @@ -72,28 +72,28 @@ touch "${tmpfile}" || fn_bad_tmpfile # (This was originally a sed one-liner.) -CedarLUG fn_display_details | sed -e 's/password="[^"]*/password="--stripped--/' | - sed -e 's/password "[^"]*/password "--stripped--/' | - sed -e 's/password: .*/password: --stripped--/' | - sed -e 's/gslt="[^"]*/gslt="--stripped--/' | - sed -e 's/gslt "[^"]*/gslt "--stripped--/' | - sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' | - sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' | - sed -e 's/authkey="[^"]*/authkey="--stripped--/' | - sed -e 's/authkey "[^"]*/authkey "--stripped--/' | - sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' | - sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' | - sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' | - sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' | - sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' | - sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' | - sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' | - sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' | - sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' | - sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' | - sed -e 's/pass="[^"]*/pass="--stripped--/' | - sed -e 's/pass "[^"]*/pass "--stripped--/' | - sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | - sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > "${tmpfile}" + sed -e 's/password "[^"]*/password "--stripped--/' | + sed -e 's/password: .*/password: --stripped--/' | + sed -e 's/gslt="[^"]*/gslt="--stripped--/' | + sed -e 's/gslt "[^"]*/gslt "--stripped--/' | + sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' | + sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' | + sed -e 's/authkey="[^"]*/authkey="--stripped--/' | + sed -e 's/authkey "[^"]*/authkey "--stripped--/' | + sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' | + sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' | + sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' | + sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' | + sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' | + sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' | + sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' | + sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' | + sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' | + sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' | + sed -e 's/pass="[^"]*/pass="--stripped--/' | + sed -e 's/pass "[^"]*/pass "--stripped--/' | + sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' | + sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > "${tmpfile}" # strip off all console escape codes (colorization) sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" @@ -101,44 +101,44 @@ sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "${tmpfile}" # If the gameserver uses anonymous steam credentials, leave them displayed # in the output. Otherwise, strip these out as well. if ! grep -q "^steampass[= ]\"\"" "${tmpfile}" ; then - sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" + sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}" fi if ! grep -q "^steamuser[= ]\"anonymous\"" "${tmpfile}" ; then - sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" + sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}" fi if [ "${posttarget}" == "http://pastebin.com" ] ; then - fn_print_dots "Posting details to pastbin.com for ${postexpire}" - sleep 1 - # grab the return from 'value' from an initial visit to pastebin. - csrftoken=$(curl -s "${posttarget}" | - sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') - # - # Use the csrftoken to then post the content. - # - link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ - -F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \ - -F "paste_name=${gamename} Debug Info" \ - -F "paste_format=8" -F "paste_private=0" \ - -F "paste_type=bash" -F "paste_code=<${tmpfile}" | - awk '/^location: / { print $2 }' | sed "s/\n//g") - - # Output the resulting link. - fn_print_ok_nl "Posting details to pastbin.com for ${postexpire}" - echo " * url: ${posttarget}/${link}" + fn_print_dots "Posting details to pastbin.com for ${postexpire}" + sleep 1 + # grab the return from 'value' from an initial visit to pastebin. + csrftoken=$(curl -s "${posttarget}" | + sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') + # + # Use the csrftoken to then post the content. + # + link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \ + -F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \ + -F "paste_name=${gamename} Debug Info" \ + -F "paste_format=8" -F "paste_private=0" \ + -F "paste_type=bash" -F "paste_code=<${tmpfile}" | + awk '/^location: / { print $2 }' | sed "s/\n//g") + + # Output the resulting link. + fn_print_ok_nl "Posting details to pastbin.com for ${postexpire}" + echo " * url: ${posttarget}${link}" elif [ "${posttarget}" == "http://hastebin.com" ] ; then - fn_print_dots "Posting details to hastbin.com for ${postexpire}" - sleep 1 - # hastebin is a bit simpler. If successful, the returned result - # should look like: {"something":"key"}, putting the reference that - # we need in "key". TODO - error handling. -CedarLUG - link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) - fn_print_ok_nl "Posting details to hastbin.com for ${postexpire}" - echo " * url: ${posttarget}/${link}" + fn_print_dots "Posting details to hastbin.com for ${postexpire}" + sleep 1 + # hastebin is a bit simpler. If successful, the returned result + # should look like: {"something":"key"}, putting the reference that + # we need in "key". TODO - error handling. -CedarLUG + link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4) + fn_print_ok_nl "Posting details to hastbin.com for ${postexpire}" + echo " * url: ${posttarget}/${link}" else - fn_print_warn_nl Review the output in "${tmpfile}" - core_exit.sh + fn_print_warn_nl Review the output in "${tmpfile}" + core_exit.sh fi # cleanup