Browse Source

ui changes

feature/dst-changes
Daniel Gibbs 2 years ago
parent
commit
06b570b3e0
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 6
      lgsm/modules/core_dl.sh
  2. 2
      lgsm/modules/install_complete.sh
  3. 83
      lgsm/modules/install_config.sh

6
lgsm/modules/core_dl.sh

@ -150,7 +150,7 @@ fn_dl_steamcmd() {
# Emptys contents of the LinuxGSM tmpdir. # Emptys contents of the LinuxGSM tmpdir.
fn_clear_tmp() { fn_clear_tmp() {
echo -en "clearing tmp directory [ ${tmpdir} ]" echo -en "clearing tmp directory [ ${italic}${tmpdir}${default} ]"
if [ -d "${tmpdir}" ]; then if [ -d "${tmpdir}" ]; then
rm -rf "${tmpdir:?}/"* rm -rf "${tmpdir:?}/"*
local exitcode=$? local exitcode=$?
@ -397,11 +397,11 @@ fn_fetch_file() {
local exitcode="" local exitcode=""
large_files=("bz2" "gz" "zip" "jar" "xz") large_files=("bz2" "gz" "zip" "jar" "xz")
if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then 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 fn_sleep_time
"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1 "${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
exitcode="$?" exitcode="$?"
echo -en "downloading file [ ${local_filename} ]" echo -en "downloading file [ ${italic}${local_filename}${default} ]"
else else
echo -en "fetching ${fileurl_name} [ ${italic}${local_filename}${default} ]\c" echo -en "fetching ${fileurl_name} [ ${italic}${local_filename}${default} ]\c"
"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1 "${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1

2
lgsm/modules/install_complete.sh

@ -20,7 +20,7 @@ elif [ "${exitcode}" == "3" ]; then
echo -e "${lightyellow}Install Completed with Warnings!${default}}" echo -e "${lightyellow}Install Completed with Warnings!${default}}"
fn_script_log_warn "Install Completed with Warnings!" fn_script_log_warn "Install Completed with Warnings!"
elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then
echo -e "${green}Install Complete!${default}}" echo -e "${green}Install Complete!${default}"
fn_script_log_pass "Install Complete!" fn_script_log_pass "Install Complete!"
fi fi

83
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. # Checks if server cfg dir exists, creates it if it doesn't.
fn_check_cfgdir() { fn_check_cfgdir() {
changes=""
if [ "${shortname}" == "dst" ]; then if [ "${shortname}" == "dst" ]; then
echo -en "creating ${clustercfgfullpath} config directory" echo -en "creating config directory [ ${italic}${clustercfgfullpath}${default} ]"
mkdir -p "${clustercfgfullpath}" changes+=$(mkdir -pv "${clustercfgfullpath}")
elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "arma3" ]; then
echo -en "creating ${networkcfgfullpath} config directory" echo -en "creating config directory [ ${italic}${networkcfgfullpath}${default} ]"
mkdir -p "${networkcfgfullpath}" changes+=$(mkdir -pv "${networkcfgfullpath}")
else else
echo -en "creating ${servercfgdir} config directory" echo -en "creating config directory [ ${italic}${servercfgdir}${default} ]"
mkdir -p "${servercfgdir}" changes+=$(mkdir -pv "${servercfgdir}")
fi fi
if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol_nl
fn_script_log_fatal "creating ${servercfgdir} config directory" fn_script_log_fatal "creating ${servercfgdir} config directory"
core_exit.sh core_exit.sh
else elif [ "${changes}" != "" ]; then
fn_print_ok_eol fn_print_ok_eol_nl
fn_script_log_pass "creating ${servercfgdir} config directory" fn_script_log_pass "creating ${servercfgdir} config directory"
else
fn_print_skip_eol_nl
fi fi
} }
@ -45,34 +47,33 @@ fn_default_config_remote() {
for config in "${array_configs[@]}"; do for config in "${array_configs[@]}"; do
if [ ! -f "${lgsmdir}/config-default/config-game/${config}" ]; then 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" 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
changes="" echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]"
if [ "${config}" == "${servercfgdefault}" ]; then changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}")
echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]" elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then
changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}") echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]"
elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}")
echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]" elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then
changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}") echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]"
elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}")
echo -en "copying config file [ ${italic}${clustercfgdefault}${default} ]" else
changes+=$(cp -n "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}") echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]"
else changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}")
echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]" fi
changes+=$(cp -n "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}") if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fi fn_print_failure_eol_nl
if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 fn_script_log_fatal "copying config file ${servercfgfullpath}"
fn_print_failure_eol_nl elif [ "${changes}" != "" ]; then
fn_script_log_fatal "copying config file ${servercfgfullpath}" fn_print_ok_eol_nl
elif [ "${changes}" != "" ]; then fn_script_log_pass "copying config file ${servercfgfullpath}"
fn_print_ok_eol_nl else
fn_script_log_pass "copying config file ${servercfgfullpath}" fn_print_skip_eol_nl
else
fn_print_skip_eol_nl
fi
fi fi
unset changes
done done
} }
@ -118,13 +119,13 @@ fn_set_config_vars() {
unset changes unset changes
randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs) 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" echo -en "generating rcon/admin password"
changes="" changes=""
if [ "${shortname}" == "squad" ]; then 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 else
changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}") changes+=$(sed -i "s/ADMINPASSWORD/${adminpass}/g w /dev/stdout" "${servercfgfullpath}")
fi fi
if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol
@ -144,7 +145,7 @@ fn_set_dst_config_vars() {
servername="LinuxGSM" servername="LinuxGSM"
echo -en "changing cluster name" echo -en "changing cluster name"
changes="" 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 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fatal "changing cluster name" 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) randomstring=$(tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 16 | xargs)
echo -en "generating cluster key" echo -en "generating cluster key"
changes="" 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 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fatal "generating cluster key" fn_script_log_fatal "generating cluster key"

Loading…
Cancel
Save