Skip to content

Commit e0acffa

Browse files
authored
feat: Refactor comments to follow standards (#2389)
1 parent 5901f19 commit e0acffa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+962
-875
lines changed

lgsm/functions/alert.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ elif [ "${alert}" == "config" ]; then
9393
fn_alert_config
9494
fi
9595

96-
# Generate alert log
96+
# Generate alert log.
9797
fn_alert_log
9898

99-
# Generates the more info link
99+
# Generates the more info link.
100100
if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
101101
alertflag=1
102102
command_postdetails.sh

lgsm/functions/alert_pushover.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
1010

1111
fn_print_dots "Sending Pushover alert"
1212

13-
# Different alerts are given different priorities and notification sounds
13+
# Different alerts are given different priorities and notification sounds.
1414
if [ "${alertsound}" == "1" ]; then
1515
alertsound=""
1616
alertpriority="0"
1717
elif [ "${alertsound}" == "2" ]; then
18-
# restarted
18+
# restarted.
1919
alertsound="siren"
2020
alertpriority="1"
2121
else

lgsm/functions/check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
local commandname="CHECK"
99

10-
# Every command that requires checks just references check.sh
11-
# check.sh selects which checks to run by using arrays
10+
# Every command that requires checks just references check.sh.
11+
# check.sh selects which checks to run by using arrays.
1212

1313
if [ "${userinput}" != "install" ]&&[ "${userinput}" != "auto-install" ]&&[ "${userinput}" != "i" ]&&[ "${userinput}" != "ai" ]; then
1414
check_root.sh

lgsm/functions/check_deps.sh

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn_install_mono_repo(){
102102
}
103103

104104
fn_install_universe_repo(){
105-
# Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu
105+
# Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu.
106106
if [ "${jquniversemissing}" != "0" ]&&[ "${distroid}" == "ubuntu" ]; then
107107
fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
108108
fn_print_information_nl "Attempting to add Universe Repo"
@@ -138,7 +138,7 @@ fn_install_universe_repo(){
138138
}
139139

140140
fn_deps_detector(){
141-
# Checks if dependency is missing
141+
# Checks if dependency is missing.
142142
if [ "${tmuxcheck}" == "1" ]; then
143143
# Added for users compiling tmux from source to bypass check.
144144
depstatus=0
@@ -152,16 +152,16 @@ fn_deps_detector(){
152152
elif [ "${deptocheck}" == "jq" ]&&[ "${distroversion}" == "6" ]; then
153153
jqstatus=1
154154
elif [ "${deptocheck}" == "jq" ]&&[ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "18.04" ]&& ! grep -qE "^deb .*universe" /etc/apt/sources.list; then
155-
#1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
156-
#If the universe repo does not exist, mark as dependency missing and universe missing
155+
# #1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
156+
# If the universe repo does not exist, mark as dependency missing and universe missing.
157157
depstatus=1
158158
jquniversemissing=1
159159
elif [ "${deptocheck}" == "mono-complete" ]; then
160160
if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
161-
# Mono >= 5.0.0 already installed
161+
# Mono >= 5.0.0 already installed.
162162
depstatus=0
163163
else
164-
# Mono not installed or installed Mono < 5.0.0
164+
# Mono not installed or installed Mono < 5.0.0.
165165
depstatus=1
166166
monostatus=1
167167
fi
@@ -174,35 +174,35 @@ fn_deps_detector(){
174174
fi
175175

176176
if [ "${depstatus}" == "0" ]; then
177-
# if dependency is found
177+
# If dependency is found.
178178
missingdep=0
179179
if [ "${function_selfname}" == "command_install.sh" ]; then
180180
echo -e "${green}${deptocheck}${default}"
181181
fn_sleep_time
182182
fi
183183
else
184-
# if dependency is not found
184+
# If dependency is not found.
185185
missingdep=1
186186
if [ "${function_selfname}" == "command_install.sh" ]; then
187187
echo -e "${red}${deptocheck}${default}"
188188
fn_sleep_time
189189
fi
190-
# Define required dependencies for SteamCMD
190+
# Define required dependencies for SteamCMD.
191191
if [ -n "${appid}" ]; then
192192
if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "libstdc++6:i386" ]; then
193193
steamcmdfail=1
194194
fi
195195
fi
196196
fi
197197

198-
# Missing dependencies are added to array_deps_missing
198+
# Missing dependencies are added to array_deps_missing.
199199
if [ "${missingdep}" == "1" ]; then
200200
array_deps_missing+=("${deptocheck}")
201201
fi
202202
}
203203

204204
fn_deps_email(){
205-
# Adds postfix to required dependencies if email alert is enabled
205+
# Adds postfix to required dependencies if email alert is enabled.
206206
if [ "${emailalert}" == "on" ]; then
207207
if [ -f /usr/bin/mailx ]; then
208208
if [ -d /etc/exim4 ]; then
@@ -316,25 +316,25 @@ fn_found_missing_deps(){
316316
}
317317

318318
fn_check_loop(){
319-
# Loop though required depenencies
319+
# Loop though required depenencies.
320320
for deptocheck in "${array_deps_required[@]}"
321321
do
322322
fn_deps_detector
323323
done
324324

325-
# user to be informed of any missing dependencies
325+
# user to be informed of any missing dependencies.
326326
fn_found_missing_deps
327327
}
328328

329-
# Generate require dependencies for debian based systems
329+
# Generate require dependencies for debian based systems.
330330
fn_deps_build_debian(){
331-
# Generate array of missing deps
331+
# Generate array of missing deps.
332332
array_deps_missing=()
333333

334-
## LinuxGSM requirements
334+
# LinuxGSM requirements.
335335
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc jq )
336336

337-
# All servers except ts3 require tmux
337+
# All servers except ts3 require tmux.
338338
if [ "${shortname}" != "ts3" ]; then
339339
if [ "$(command -v tmux 2>/dev/null)" ]; then
340340
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
@@ -343,7 +343,7 @@ fn_deps_build_debian(){
343343
fi
344344
fi
345345

346-
# All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1
346+
# All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1.
347347
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
348348
if [ "${arch}" == "x86_64" ]; then
349349
array_deps_required+=( lib32gcc1 libstdc++6:i386 )
@@ -352,9 +352,9 @@ fn_deps_build_debian(){
352352
fi
353353
fi
354354

355-
## Game Specific requirements
355+
# Game Specific requirements.
356356

357-
# Natural Selection 2 - x64 only
357+
# Natural Selection 2 - x64 only.
358358
if [ "${shortname}" == "ns2" ]; then
359359
array_deps_required+=( speex libtbb2 )
360360
# NS2: Combat
@@ -392,14 +392,16 @@ fn_deps_build_debian(){
392392
elif [ "${shortname}" == "mc" ]; then
393393
javaversion=$(java -version 2>&1 | grep "version")
394394
if [ "${javaversion}" ]; then
395-
javacheck=1 # Added for users using Oracle JRE to bypass the check.
395+
# Added for users using Oracle JRE to bypass the check.
396+
javacheck=1
396397
else
397398
array_deps_required+=( openjdk-8-jre-headless )
398399
fi
399400
# Project Zomboid
400401
elif [ "${shortname}" == "pz" ]; then
401402
if [ -n "$(java -version 2>&1 | grep "version")" ]; then
402-
javacheck=1 # Added for users using Oracle JRE to bypass the check.
403+
# Added for users using Oracle JRE to bypass the check.
404+
javacheck=1
403405
array_deps_required+=( rng-tools )
404406
else
405407
array_deps_required+=( default-jre rng-tools )
@@ -415,10 +417,10 @@ fn_deps_build_debian(){
415417
array_deps_required+=( libssl1.0.0:i386 zlib1g:i386 )
416418
# Unreal Engine
417419
elif [ "${executable}" == "./ucc-bin" ]; then
418-
#UT2K4
420+
# UT2K4
419421
if [ -f "${executabledir}/ut2004-bin" ]; then
420422
array_deps_required+=( libsdl1.2debian libstdc++5:i386 )
421-
#UT99
423+
# UT99
422424
else
423425
array_deps_required+=( libsdl1.2debian )
424426
fi
@@ -437,11 +439,11 @@ fn_deps_build_debian(){
437439
}
438440

439441
fn_deps_build_redhat(){
440-
# Generate array of missing deps
442+
# Generate array of missing deps.
441443
array_deps_missing=()
442444

443-
# LinuxGSM requirements
444-
## CentOS 6
445+
# LinuxGSM requirements.
446+
# CentOS 6
445447
if [ "${distroversion}" == "6" ]; then
446448
array_deps_required=( epel-release curl wget util-linux-ng python file gzip bzip2 unzip binutils bc jq )
447449
elif [ "${distroversion}" == "7" ]; then
@@ -454,16 +456,17 @@ fn_deps_build_redhat(){
454456
array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc jq )
455457
fi
456458

457-
# All servers except ts3 require tmux
459+
# All servers except ts3 require tmux.
458460
if [ "${shortname}" != "ts3" ]; then
459461
if [ "$(command -v tmux 2>/dev/null)" ]; then
460-
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
462+
# Added for users compiling tmux from source to bypass check.
463+
tmuxcheck=1
461464
else
462465
array_deps_required+=( tmux )
463466
fi
464467
fi
465468

466-
# All servers except ts3,mumble,multitheftauto and minecraft servers require glibc.i686 and libstdc++.i686
469+
# All servers except ts3, mumble, multi theft auto and minecraft servers require glibc.i686 and libstdc++.i686.
467470
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
468471
if [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
469472
array_deps_required+=( glibc.i686 libstdc++64.i686 )
@@ -472,7 +475,7 @@ fn_deps_build_redhat(){
472475
fi
473476
fi
474477

475-
# Game Specific requirements
478+
# Game Specific requirements.
476479

477480
# Natural Selection 2 (x64 only)
478481
if [ "${shortname}" == "ns2" ]; then
@@ -507,7 +510,8 @@ fn_deps_build_redhat(){
507510
elif [ "${shortname}" == "mc" ]; then
508511
javaversion=$(java -version 2>&1 | grep "version")
509512
if [ "${javaversion}" ]; then
510-
javacheck=1 # Added for users using Oracle JRE to bypass the check.
513+
# Added for users using Oracle JRE to bypass the check.
514+
javacheck=1
511515
array_deps_required+=( rng-tools )
512516
else
513517
array_deps_required+=( java-1.8.0-openjdk rng-tools )
@@ -516,7 +520,8 @@ fn_deps_build_redhat(){
516520
elif [ "${shortname}" == "pz" ]; then
517521
javaversion=$(java -version 2>&1 | grep "version")
518522
if [ "${javaversion}" ]; then
519-
javacheck=1 # Added for users using Oracle JRE to bypass the check.
523+
# Added for users using Oracle JRE to bypass the check.
524+
javacheck=1
520525
array_deps_required+=( rng-tools )
521526
else
522527
array_deps_required+=( java-1.8.0-openjdk rng-tools )
@@ -559,7 +564,7 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
559564
fi
560565
fi
561566

562-
# Filter checking in to Debian or Red Hat Based
567+
# Filter checking in to Debian or Red Hat Based.
563568
info_distro.sh
564569
if [ -f "/etc/debian_version" ]; then
565570
fn_deps_build_debian

lgsm/functions/check_ip.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
1818
info_config.sh
1919
info_parms.sh
2020

21-
# IP is not set to specific IP
21+
# IP is not set to specific IP.
2222
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
2323
fn_print_dots "Check IP"
24-
# Multiple interfaces
24+
# Multiple interfaces.
2525
if [ "${getipwc}" -ge "2" ]; then
2626
if [ "${function_selfname}" == "command_details.sh" ]; then
2727
fn_print_warn "Check IP: Multiple IP addresses found."
2828
else
2929
fn_print_fail "Check IP: Multiple IP addresses found."
3030
fi
3131
echo -en "\n"
32-
# IP is set within game config
32+
# IP is set within game config.
3333
if [ "${ipsetinconfig}" == "1" ]; then
3434
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
3535
echo -en " * location: ${servercfgfullpath}\n"
3636
echo -en "\n"
3737
echo -en "Set ${ipinconfigvar} to one of the following:\n"
3838
fn_script_log_fatal "Multiple IP addresses found."
3939
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
40-
# IP is set within LinuxGSM config
40+
# IP is set within LinuxGSM config.
4141
else
4242
fn_print_information_nl "Specify the IP you want to bind within a LinuxGSM config file.\n"
4343
echo -en " * location: ${configdirserver}\n"
@@ -54,14 +54,14 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
5454
echo -en "\n"
5555
echo -en "https://linuxgsm.com/network-interfaces\n"
5656
echo -en ""
57-
# Do not exit for details and postdetails commands
57+
# Do not exit for details and postdetails commands.
5858
if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then
5959
fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
6060
core_exit.sh
6161
else
6262
ip="NOT SET"
6363
fi
64-
# Single interface
64+
# Single interface.
6565
elif [ "${ipsetinconfig}" == "1" ]; then
6666
fn_print_fail "Check IP: IP address not set in game config."
6767
echo -en "\n"

lgsm/functions/check_logs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ fn_check_logs(){
1414
install_logs.sh
1515
}
1616

17-
# Create directories for the script and console logs
17+
# Create directories for the script and console logs.
1818
if [ ! -d "${lgsmlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${shortname}" != "ts3" ]; then
1919
fn_check_logs
2020
fi
2121

22-
# Create gamelogdir
23-
# If variable exists gamelogdir exists and log/server does not
22+
# Create gamelogdir.
23+
# If variable exists gamelogdir exists and log/server does not.
2424
if [ -n "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then
2525
fn_check_logs
2626
fi

0 commit comments

Comments
 (0)