From 06b570b3e0d58a13eef31aa8dcd398439b1cd489 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 29 Sep 2023 00:19:13 +0100 Subject: [PATCH] ui changes --- lgsm/modules/core_dl.sh | 6 +-- lgsm/modules/install_complete.sh | 2 +- lgsm/modules/install_config.sh | 83 ++++++++++++++++---------------- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh index 59c67d1249..2fe92a2d15 100644 --- a/lgsm/modules/core_dl.sh +++ b/lgsm/modules/core_dl.sh @@ -150,7 +150,7 @@ fn_dl_steamcmd() { # Emptys contents of the LinuxGSM tmpdir. fn_clear_tmp() { - echo -en "clearing tmp directory [ ${tmpdir} ]" + echo -en "clearing tmp directory [ ${italic}${tmpdir}${default} ]" if [ -d "${tmpdir}" ]; then rm -rf "${tmpdir:?}/"* local exitcode=$? @@ -397,11 +397,11 @@ fn_fetch_file() { local exitcode="" large_files=("bz2" "gz" "zip" "jar" "xz") if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then - echo -e "downloading file [ ${local_filename} ]" + echo -e "downloading file [ ${italic}${local_filename}${default} ]" fn_sleep_time "${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1 exitcode="$?" - echo -en "downloading file [ ${local_filename} ]" + echo -en "downloading file [ ${italic}${local_filename}${default} ]" else echo -en "fetching ${fileurl_name} [ ${italic}${local_filename}${default} ]\c" "${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1 diff --git a/lgsm/modules/install_complete.sh b/lgsm/modules/install_complete.sh index cc24884770..039d2366fb 100644 --- a/lgsm/modules/install_complete.sh +++ b/lgsm/modules/install_complete.sh @@ -20,7 +20,7 @@ elif [ "${exitcode}" == "3" ]; then echo -e "${lightyellow}Install Completed with Warnings!${default}}" fn_script_log_warn "Install Completed with Warnings!" elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then - echo -e "${green}Install Complete!${default}}" + echo -e "${green}Install Complete!${default}" fn_script_log_pass "Install Complete!" fi diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index 22cd9f19c0..758e56440f 100644 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -9,24 +9,26 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Checks if server cfg dir exists, creates it if it doesn't. fn_check_cfgdir() { - + changes="" if [ "${shortname}" == "dst" ]; then - echo -en "creating ${clustercfgfullpath} config directory" - mkdir -p "${clustercfgfullpath}" + echo -en "creating config directory [ ${italic}${clustercfgfullpath}${default} ]" + changes+=$(mkdir -pv "${clustercfgfullpath}") elif [ "${shortname}" == "arma3" ]; then - echo -en "creating ${networkcfgfullpath} config directory" - mkdir -p "${networkcfgfullpath}" + echo -en "creating config directory [ ${italic}${networkcfgfullpath}${default} ]" + changes+=$(mkdir -pv "${networkcfgfullpath}") else - echo -en "creating ${servercfgdir} config directory" - mkdir -p "${servercfgdir}" + echo -en "creating config directory [ ${italic}${servercfgdir}${default} ]" + changes+=$(mkdir -pv "${servercfgdir}") fi if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 - fn_print_fail_eol + fn_print_fail_eol_nl fn_script_log_fatal "creating ${servercfgdir} config directory" core_exit.sh - else - fn_print_ok_eol + elif [ "${changes}" != "" ]; then + fn_print_ok_eol_nl fn_script_log_pass "creating ${servercfgdir} config directory" + else + fn_print_skip_eol_nl fi } @@ -45,34 +47,33 @@ fn_default_config_remote() { for config in "${array_configs[@]}"; do if [ ! -f "${lgsmdir}/config-default/config-game/${config}" ]; then fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash" + fi + fn_check_cfgdir - fn_check_cfgdir - - changes="" - if [ "${config}" == "${servercfgdefault}" ]; then - echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]" - changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}") - elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then - echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]" - changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}") - elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then - echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]" - changes+=$(cp -n "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}") - else - echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]" - changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}") - fi - if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 - fn_print_failure_eol_nl - fn_script_log_fatal "copying config file ${servercfgfullpath}" - elif [ "${changes}" != "" ]; then - fn_print_ok_eol_nl - fn_script_log_pass "copying config file ${servercfgfullpath}" - else - fn_print_skip_eol_nl - fi - + changes="" + if [ "${config}" == "${servercfgdefault}" ]; then + echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]" + changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}") + elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then + echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]" + changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}") + elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then + echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]" + changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}") + else + echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]" + changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}") + fi + if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 + fn_print_failure_eol_nl + fn_script_log_fatal "copying config file ${servercfgfullpath}" + elif [ "${changes}" != "" ]; then + fn_print_ok_eol_nl + fn_script_log_pass "copying config file ${servercfgfullpath}" + else + fn_print_skip_eol_nl fi + unset changes done } @@ -118,13 +119,13 @@ fn_set_config_vars() { unset changes randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs) - rconpass="admin${randomstring}" + adminpass="admin${randomstring}" echo -en "generating rcon/admin password" changes="" if [ "${shortname}" == "squad" ]; then - changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg") + changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgdir}/Rcon.cfg") else - changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}") + changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgfullpath}") fi if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 fn_print_fail_eol @@ -144,7 +145,7 @@ fn_set_dst_config_vars() { servername="LinuxGSM" echo -en "changing cluster name" changes="" - changes+=$(sed -i "s/SERVERNAME/${servername}/g" "${clustercfgfullpath}") + changes+=$(sed -i "s/SERVERNAME/${servername}/g w /dev/stdout" "${clustercfgfullpath}") if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 fn_print_fail_eol fn_script_log_fatal "changing cluster name" @@ -159,7 +160,7 @@ fn_set_dst_config_vars() { randomstring=$(tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 16 | xargs) echo -en "generating cluster key" changes="" - changes+=$(sed -i "s/CLUSTERKEY/${randomstring}/g" "${clustercfgfullpath}") + changes+=$(sed -i "s/CLUSTERKEY/${randomstring}/g w /dev/stdout" "${clustercfgfullpath}") if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 fn_print_fail_eol fn_script_log_fatal "generating cluster key"