Skip to content

Commit

Permalink
refactor: improve readability and consistency in code
Browse files Browse the repository at this point in the history
- Refactored echo statements to provide more informative messages.
- Renamed variables for better clarity.
- Removed unnecessary comments and unused code.
  • Loading branch information
dgibbs64 committed Sep 26, 2023
1 parent 0eac5a1 commit e239aa5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lgsm/modules/command_update_linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else
fi

# Check linuxsm.sh
echo -en "checking ${remotereponame} linuxgsm.sh...\c"
echo -en "checking ${remotereponame} ( linuxgsm.sh )\c"
if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
else
Expand Down Expand Up @@ -68,13 +68,13 @@ fi
# Check gameserver.sh
# Compare gameserver.sh against linuxgsm.sh in the tmp dir.
# Ignoring server specific vars.
echo -en "checking ${selfname}...\c"
echo -en "checking ${selfname}\c"
fn_script_log_info "Checking ${selfname}"
script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
if [ "${script_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log "Checking ${selfname}"
echo -en "backup ${selfname}...\c"
echo -en "backup ${selfname}\c"
fn_script_log_info "Backup ${selfname}"
if [ ! -d "${backupdir}/script" ]; then
mkdir -p "${backupdir}/script"
Expand Down Expand Up @@ -115,7 +115,7 @@ else
fi

# Check _default.cfg.
echo -en "checking ${remotereponame} config _default.cfg...\c"
echo -en "checking ${remotereponame} config ( _default.cfg )\c"
fn_script_log_info "Checking ${remotereponame} config _default.cfg"
if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
Expand Down Expand Up @@ -149,7 +149,7 @@ fi

# Check distro csv. ${datadir}/${distroid}-${distroversioncsv}.csv
if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c"
echo -en "checking ${remotereponame} config ( ${distroid}-${distroversioncsv}.csv )\c"
fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
Expand Down Expand Up @@ -187,7 +187,7 @@ if [ -n "${modulesdir}" ]; then
for modulefile in *; do
# check if module exists in the repo and remove if missing.
# commonly used if module names change.
echo -en "checking ${remotereponame} module ${modulefile}...\c"
echo -en "checking ${remotereponame} module ( ${modulefile} )\c"
github_file_url_dir="lgsm/modules"
if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/core_dl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ fn_fetch_file() {
"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
exitcode="$?"
else
echo -en "${dim}fetching from ${fileurl_name} ( ${local_filename} )\c"
echo -en "fetching from ${fileurl_name} ( ${local_filename} )\c"
"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1
exitcode="$?"
fi
Expand Down
2 changes: 1 addition & 1 deletion linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn_bootstrap_fetch_file() {
trap fn_fetch_trap INT
# Larger files show a progress bar.

echo -en "fetching from ${fileurl_name} ( ${local_filename} )\c"
echo -en "fetching ${fileurl_name} ( ${local_filename} )\c"
curlcmd=$(curl --connect-timeout 10 -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1)

local exitcode=$?
Expand Down

0 comments on commit e239aa5

Please sign in to comment.