Browse Source

messages

pull/2959/head
Daniel Gibbs 5 years ago
parent
commit
981b5590d9
  1. 17
      lgsm/functions/command_backup.sh
  2. 80
      lgsm/functions/command_validate.sh
  3. 92
      lgsm/functions/core_dl.sh
  4. 30
      lgsm/functions/core_messages.sh
  5. 17
      lgsm/functions/update_factorio.sh
  6. 17
      lgsm/functions/update_minecraft.sh
  7. 17
      lgsm/functions/update_minecraft_bedrock.sh
  8. 17
      lgsm/functions/update_mta.sh
  9. 17
      lgsm/functions/update_mumble.sh
  10. 21
      lgsm/functions/update_steamcmd.sh
  11. 17
      lgsm/functions/update_ts3.sh

17
lgsm/functions/command_backup.sh

@ -73,7 +73,7 @@ fn_backup_stop_server(){
fn_script_log_warn "Although unlikely; creating a backup while ${selfname} is running might corrupt the backup"
# Server is running and will be stopped if stoponbackup=on or unset.
else
fn_stop_warning
fn_print_stop_warning_backup
serverstopped="yes"
exitbypass=1
command_stop.sh
@ -246,21 +246,6 @@ fn_backup_relpath() {
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during backup"
}
# Restart the server if it was stopped for the backup.
fn_backup_start_server(){
if [ "${serverstopped}" == "yes" ]; then

80
lgsm/functions/command_validate.sh

@ -4,92 +4,38 @@
# Website: https://linuxgsm.com
# Description: Runs a server validation.
commandname="VALIDATE"
commandaction="Validating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_validate(){
fn_script_log_warn "${remotelocation}: Validate might overwrite some customised files"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "${remotelocation}: Validate might overwrite some customised files: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "${remotelocation}: Validate might overwrite some customised files"
fn_print_start_nl "${remotelocation}"
fn_script_log_info "Validating server: ${remotelocation}"
info_distro.sh
if [ -d "${steamcmddir}" ]; then
cd "${steamcmddir}" || exit
fi
if [ "$(command -v unbuffer)" ]; then
unbuffer="unbuffer"
fi
# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
if [ "${appid}" == "90" ]; then
# If using a specific branch.
if [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
else
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
fi
elif [ "${shortname}" == "ac" ]; then
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit
local exitcode=$?
# All other servers.
elif [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
else
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
fi
exitcode=$?
fn_print_dots "${remotelocation}"
if [ "${exitcode}" != "0" ]; then
fn_print_fail_nl "${remotelocation}"
fn_script_log_fatal "Validating server: ${remotelocation}: FAIL"
else
fn_print_ok_nl "${remotelocation}"
fn_script_log_pass "Validating server: ${remotelocation}: OK"
fi
core_exit.sh
fn_commandname(){
commandname="VALIDATE"
commandaction="Validating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_stop_warning(){
fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_script_log_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_validate(){
fn_script_log_warn "SteamCMD: Validate might overwrite some customised files"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation: ${totalseconds}"
fn_print_warn "SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_dl_steamcmd
}
# The location where the builds are checked and downloaded.
remotelocation="SteamCMD"
fn_print_dots "SteamCMD"
check.sh
fn_print_dots "${remotelocation}"
if [ "${status}" != "0" ]; then
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
fn_commandname
fn_validate
exitbypass=1
command_start.sh
fn_commandname
else
fn_validate
fi

92
lgsm/functions/core_dl.sh

@ -19,6 +19,98 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_dl_steamcmd(){
fn_print_start_nl "${remotelocation}"
fn_script_log_info "${commandaction} server: ${remotelocation}"
if [ -d "${steamcmddir}" ]; then
cd "${steamcmddir}" || exit
fi
# Unbuffer will allow the output of steamcmd not buffer allowing a smooth output.
# unbuffer us part of the expect package.
if [ "$(command -v unbuffer)" ]; then
unbuffer="unbuffer"
fi
# Validate will be added as a parameter if required.
if [ "${commandname}" == "VALIDATE" ]||[ "${commandname}" == "INSTALL" ]; then
validate="validate"
fi
# To do error checking for SteamCMD the output of steamcmd will be saved to a log.
steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log"
counter=0
while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
counter=$((counter+1))
# Select SteamCMD parameters
# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
if [ "${appid}" == "90" ]; then
# If using a specific branch.
if [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
else
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
fi
# Force Windows Platform type.
elif [ "${shortname}" == "ac" ]; then
if [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
else
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
fi
# All other servers.
else
if [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
else
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${validate} +quit | tee -a "${lgsmlog}" "${steamcmdlog}"
fi
fi
# Error checking for SteamCMD. Some errors will loop to try again and some will just exit.
exitcode=$?
if [ -n "$(grep "Error!" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "ERROR!" "${steamcmdlog}" | tail -1)" ]; then
# Not enough space.
if [ -n "$(grep "0x202" "${steamcmdlog}" | tail -1)" ]; then
fn_print_failure_nl "${commandaction} server: ${remotelocation}: Not enough space to download server files"
fn_script_log_fatal "${commandaction} server: ${remotelocation}: Not enough space to download server files"
core_exit.sh
# Need tp purchase game.
elif [ -n "$(grep "No subscription" "${steamcmdlog}" | tail -1)" ]; then
fn_print_failure_nl "${commandaction} server: ${remotelocation}: Game not owned by any authorised accounts"
fn_script_log_fatal "${commandaction} server: ${remotelocation}: Game not owned by any authorised accounts"
core_exit.sh
# Two-factor authentication failure
elif [ -n "$(grep "Two-factor code mismatch" "${steamcmdlog}" | tail -1)" ]; then
fn_print_failure_nl "${commandaction} server: ${remotelocation}: Two-factor authentication failure"
fn_script_log_fatal "${commandaction} server: ${remotelocation}: Two-factor authentication failure"
core_exit.sh
# Update did not finish.
elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then
fn_print_error2_nl "${commandaction} server: ${remotelocation}: Update required but not completed - check network"
fn_script_log_error "${commandaction} server: ${remotelocation}: Update required but not completed - check network"
else
fn_print_error2_nl "${commandaction} server: ${remotelocation}: Unknown error occured"
fn_script_log_error "${commandaction} server: ${remotelocation}: Unknown error occured"
fi
elif [ "${exitcode}" != "0" ]; then
fn_print_error2_nl "${commandaction} server: ${remotelocation}: Exit code: ${exitcode}"
fn_script_log_error "${commandaction} server: ${remotelocation}: Exit code: ${exitcode}"
else
fn_print_complete_nl "${commandaction} server: ${remotelocation}"
fn_script_log_pass "${commandaction} server: ${remotelocation}"
fi
if [ "${counter}" -gt "10" ]; then
fn_print_failure_nl "${commandaction} server: ${remotelocation}: Did not complete the download, too many retrys"
fn_script_log_fatal "${commandaction} server: ${remotelocation}: Did not complete the download, too many retrys"
core_exit.sh
fi
done
}
# Emptys contents of the LinuxGSM tmpdir.
fn_clear_tmp(){
echo -en "clearing LinuxGSM tmp directory..."

30
lgsm/functions/core_messages.sh

@ -529,3 +529,33 @@ fn_print_ascii_logo(){
echo -e "${lightyellow}LinuxGSM${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}Y8888Y${default} ${lightyellow}888${default} ${lightyellow}888${default} Y2012P88 Y8888P 888 888"
echo -e ""
}
fn_print_stop_warning_update(){
fn_print_warn "${commandaction} server: ${remotelocation}: ${selfname} will be stopped during update"
fn_script_log_warn "${commandaction} server: ${remotelocation}: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "${commandaction} server: ${remotelocation}: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "${commandaction} server: SteamCMD: ${selfname} will be stopped during update"
}
fn_print_stop_warning_backup(){
fn_print_warn "${commandaction} server: ${selfname} will be stopped during backup"
fn_script_log_warn "${commandaction} server: ${selfname} will be stopped during backup"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "${commandaction} server: ${selfname} will be stopped during backup: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "${commandaction} server: ${selfname} will be stopped during backup: ${totalseconds}"
}

17
lgsm/functions/update_factorio.sh

@ -100,7 +100,7 @@ fn_update_factorio_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -130,21 +130,6 @@ fn_update_factorio_compare(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="factorio.com"

17
lgsm/functions/update_minecraft.sh

@ -159,7 +159,7 @@ fn_update_minecraft_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -189,21 +189,6 @@ fn_update_minecraft_compare(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="mojang.com"

17
lgsm/functions/update_minecraft_bedrock.sh

@ -125,7 +125,7 @@ fn_update_minecraft_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -149,21 +149,6 @@ fn_update_minecraft_compare(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="minecraft.net"

17
lgsm/functions/update_mta.sh

@ -156,7 +156,7 @@ fn_update_mta_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -180,21 +180,6 @@ fn_update_mta_compare(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="linux.mtasa.com"

17
lgsm/functions/update_mumble.sh

@ -93,7 +93,7 @@ fn_update_mumble_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -117,21 +117,6 @@ fn_update_mumble_compare(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="mumble.info"

21
lgsm/functions/update_steamcmd.sh

@ -15,7 +15,7 @@ fn_update_steamcmd_dl(){
fi
# Unbuffer will allow the output of steamcmd not buffer allowing a smooth output.
# unbuffer us part of the except package.
# unbuffer us part of the expect package.
if [ "$(command -v unbuffer)" ]; then
unbuffer="unbuffer"
fi
@ -185,7 +185,7 @@ fn_update_steamcmd_compare(){
fn_update_steamcmd_dl
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -265,21 +265,6 @@ fn_appmanifest_check(){
fi
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="SteamCMD"
check.sh
@ -289,7 +274,7 @@ fn_print_dots "${remotelocation}"
if [ "${forceupdate}" == "1" ]; then
# forceupdate bypasses update checks.
if [ "${status}" != "0" ]; then
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
fn_commandname

17
lgsm/functions/update_ts3.sh

@ -154,7 +154,7 @@ fn_update_ts3_compare(){
command_stop.sh
# If server started.
else
fn_stop_warning
fn_print_stop_warning_update
exitbypass=1
command_stop.sh
exitbypass=1
@ -190,21 +190,6 @@ else
core_exit.sh
fi
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
}
# The location where the builds are checked and downloaded.
remotelocation="teamspeak.com"

Loading…
Cancel
Save