Skip to content

Commit f9a5ed0

Browse files
committed
fix: revert modules in functions dir to v23.2.3
1 parent c2e3155 commit f9a5ed0

13 files changed

+252
-263
lines changed

lgsm/functions/check_logs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Website: https://linuxgsm.com
66
# Description: Checks if log files exist.
77

8-
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
8+
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
99

1010
fn_check_logs() {
1111
fn_print_dots "Checking for log files"

lgsm/functions/check_root.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Website: https://linuxgsm.com
66
# Description: Checks if the user tried to run the script as root.
77

8-
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
8+
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
99

1010
if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then
1111
if [ "${commandname}" != "INSTALL" ]; then

lgsm/functions/command_update_linuxgsm.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Author: Daniel Gibbs
44
# Contributors: http://linuxgsm.com/contrib
55
# Website: https://linuxgsm.com
6-
# Description: Deletes the modules dir to allow re-downloading of modules from GitHub.
6+
# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
77

88
commandname="UPDATE-LGSM"
99
commandaction="Updating LinuxGSM"
10-
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
10+
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
1111
fn_firstcommand_set
1212

1313
check.sh
@@ -180,57 +180,57 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
180180
fi
181181
fi
182182
# Check and update modules.
183-
if [ -n "${modulesdir}" ]; then
184-
if [ -d "${modulesdir}" ]; then
183+
if [ -n "${functionsdir}" ]; then
184+
if [ -d "${functionsdir}" ]; then
185185
(
186-
cd "${modulesdir}" || exit
187-
for modulefile in *; do
186+
cd "${functionsdir}" || exit
187+
for functionfile in *; do
188188
# check if module exists in the repo and remove if missing.
189189
# commonly used if module names change.
190-
echo -en "checking ${remotereponame} module ${modulefile}...\c"
191-
github_file_url_dir="lgsm/modules"
190+
echo -en "checking ${remotereponame} module ${functionfile}...\c"
191+
github_file_url_dir="lgsm/functions"
192192
if [ "${remotereponame}" == "GitHub" ]; then
193-
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
193+
curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null
194194
else
195-
curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
195+
curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null
196196
fi
197197
if [ $? != 0 ]; then
198198
fn_print_error_eol_nl
199-
fn_script_log_error "Checking ${remotereponame} module ${modulefile}"
200-
echo -en "removing module ${modulefile}...\c"
201-
if ! rm -f "${modulefile:?}"; then
199+
fn_script_log_error "Checking ${remotereponame} module ${functionfile}"
200+
echo -en "removing module ${functionfile}...\c"
201+
if ! rm -f "${functionfile:?}"; then
202202
fn_print_fail_eol_nl
203-
fn_script_log_fatal "Removing module ${modulefile}"
203+
fn_script_log_fatal "Removing module ${functionfile}"
204204
core_exit.sh
205205
else
206206
fn_print_ok_eol_nl
207-
fn_script_log_pass "Removing module ${modulefile}"
207+
fn_script_log_pass "Removing module ${functionfile}"
208208
fi
209209
else
210210
# compare file
211211
if [ "${remotereponame}" == "GitHub" ]; then
212-
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}"))
212+
function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
213213
else
214-
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}"))
214+
function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}"))
215215
fi
216216

217217
# results
218-
if [ "${module_file_diff}" != "" ]; then
218+
if [ "${function_file_diff}" != "" ]; then
219219
fn_print_update_eol_nl
220-
fn_script_log_update "Checking ${remotereponame} module ${modulefile}"
221-
rm -rf "${modulesdir:?}/${modulefile}"
222-
fn_update_module
220+
fn_script_log_update "Checking ${remotereponame} module ${functionfile}"
221+
rm -rf "${functionsdir:?}/${functionfile}"
222+
fn_update_function
223223
else
224224
fn_print_ok_eol_nl
225-
fn_script_log_pass "Checking ${remotereponame} module ${modulefile}"
225+
fn_script_log_pass "Checking ${remotereponame} module ${functionfile}"
226226
fi
227227
fi
228228
done
229229
)
230230
fi
231231
fi
232232

233-
fn_print_ok_nl "Updating modules"
234-
fn_script_log_pass "Updating modules"
233+
fn_print_ok_nl "Updating functions"
234+
fn_script_log_pass "Updating functions"
235235

236236
core_exit.sh

lgsm/functions/core_dl.sh

Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
1818
# fn_fetch_file "http://example.com/file.tar.bz2" "http://example.com/file2.tar.bz2" "file.tar.bz2" "file2.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
1919

20-
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
20+
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
2121

2222
fn_dl_steamcmd() {
2323
fn_print_start_nl "${remotelocation}"
@@ -453,13 +453,11 @@ fn_fetch_file() {
453453
fi
454454
}
455455

456-
# GitHub file download modules.
456+
# GitHub file download functions.
457457
# Used to simplify downloading specific files from GitHub.
458458

459-
# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules
460-
# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
461-
# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules
462-
# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
459+
# github_fileurl_dir: the directory of the file in the GitHub: lgsm/functions
460+
# github_fileurl_name: the filename of the file to download from GitHub: core_messages.sh
463461
# githuburl: the full GitHub url
464462

465463
# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
@@ -472,58 +470,58 @@ fn_fetch_file() {
472470

473471
# Fetches files from the Git repo.
474472
fn_fetch_file_github() {
475-
github_file_url_dir="${1}"
476-
github_file_url_name="${2}"
473+
github_fileurl_dir="${1}"
474+
github_fileurl_name="${2}"
477475
# For legacy versions - code can be removed at a future date
478476
if [ "${legacymode}" == "1" ]; then
479-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
480-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
477+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
478+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
481479
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
482-
elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
483-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
484-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
480+
elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
481+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
482+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
485483
else
486-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
487-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
484+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
485+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
488486
fi
489487
remote_fileurl_name="GitHub"
490488
remote_fileurl_backup_name="Bitbucket"
491489
local_filedir="${3}"
492-
local_filename="${github_file_url_name}"
490+
local_filename="${github_fileurl_name}"
493491
chmodx="${4:-0}"
494492
run="${5:-0}"
495493
forcedl="${6:-0}"
496494
hash="${7:-0}"
497-
# Passes vars to the file download module.
495+
# Passes vars to the file download function.
498496
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
499497
}
500498

501499
fn_check_file_github() {
502-
github_file_url_dir="${1}"
503-
github_file_url_name="${2}"
504-
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
505-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
506-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
500+
github_fileurl_dir="${1}"
501+
github_fileurl_name="${2}"
502+
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
503+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
504+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
507505
else
508-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
509-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
506+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
507+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
510508
fi
511509
remote_fileurl_name="GitHub"
512510
remote_fileurl_backup_name="Bitbucket"
513-
fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_file_url_name}"
511+
fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_fileurl_name}"
514512
}
515513

516514
# Fetches config files from the Git repo.
517515
fn_fetch_config() {
518-
github_file_url_dir="${1}"
519-
github_file_url_name="${2}"
516+
github_fileurl_dir="${1}"
517+
github_fileurl_name="${2}"
520518
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
521-
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
522-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
523-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
519+
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
520+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
521+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
524522
else
525-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
526-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
523+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
524+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
527525
fi
528526
remote_fileurl_name="GitHub"
529527
remote_fileurl_backup_name="Bitbucket"
@@ -533,55 +531,55 @@ fn_fetch_config() {
533531
run="norun"
534532
forcedl="noforce"
535533
hash="nohash"
536-
# Passes vars to the file download module.
534+
# Passes vars to the file download function.
537535
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
538536
}
539537

540538
# Fetches modules from the Git repo during first download.
541-
fn_fetch_module() {
542-
github_file_url_dir="lgsm/modules"
543-
github_file_url_name="${modulefile}"
539+
fn_fetch_function() {
540+
github_fileurl_dir="lgsm/functions"
541+
github_fileurl_name="${functionfile}"
544542
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
545-
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
546-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
547-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
543+
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
544+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
545+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
548546
else
549-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
550-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
547+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
548+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
551549
fi
552550
remote_fileurl_name="GitHub"
553551
remote_fileurl_backup_name="Bitbucket"
554-
local_filedir="${modulesdir}"
555-
local_filename="${github_file_url_name}"
552+
local_filedir="${functionsdir}"
553+
local_filename="${github_fileurl_name}"
556554
chmodx="chmodx"
557555
run="run"
558556
forcedl="noforce"
559557
hash="nohash"
560-
# Passes vars to the file download module.
558+
# Passes vars to the file download function.
561559
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
562560
}
563561

564562
# Fetches modules from the Git repo during update-lgsm.
565-
fn_update_module() {
566-
github_file_url_dir="lgsm/modules"
567-
github_file_url_name="${modulefile}"
563+
fn_update_function() {
564+
github_fileurl_dir="lgsm/functions"
565+
github_fileurl_name="${functionfile}"
568566
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
569-
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
570-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
571-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
567+
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
568+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
569+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
572570
else
573-
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
574-
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
571+
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
572+
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
575573
fi
576574
remote_fileurl_name="GitHub"
577575
remote_fileurl_backup_name="Bitbucket"
578-
local_filedir="${modulesdir}"
579-
local_filename="${github_file_url_name}"
576+
local_filedir="${functionsdir}"
577+
local_filename="${github_fileurl_name}"
580578
chmodx="chmodx"
581579
run="norun"
582580
forcedl="noforce"
583581
hash="nohash"
584-
# Passes vars to the file download module.
582+
# Passes vars to the file download function.
585583
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
586584

587585
}
@@ -620,7 +618,7 @@ fn_dl_latest_release_github() {
620618
fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}"
621619
fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}"
622620
else
623-
# Fetch file from the remote location from the existing module to the ${tmpdir} for now.
621+
# Fetch file from the remote location from the existing function to the ${tmpdir} for now.
624622
fn_fetch_file "${githubreleasedownloadlink}" "" "${githubreleasefilename}" "" "${githubreleasedownloadpath}" "${githubreleasefilename}"
625623
fi
626624
fi

0 commit comments

Comments
 (0)