Browse Source
Fixes glibc check and mod selection logic
Corrects glibc version comparison to properly handle version strings.
Improves mod installation and removal by validating user input
against available options, providing a more robust selection process.
This prevents errors caused by invalid mod names and enhances the
user experience.
Updates arithmetic expression syntax for better compatibility.
pull/4854/head
Daniel Gibbs
4 months ago
Failed to extract signature
5 changed files with
41 additions and
15 deletions
lgsm/modules/check_glibc.sh
lgsm/modules/command_debug.sh
lgsm/modules/command_dev_query_raw.sh
lgsm/modules/command_mods_install.sh
lgsm/modules/command_mods_remove.sh
@ -17,7 +17,7 @@ elif [ -z "${glibc}" ]; then
fn_print_error_nl "Checking glibc: requirement unknown"
fn_script_log_error "Checking glibc: requirement unknown"
fn_sleep_time_5
elif [ " $( printf '%s\n' ${ glibc } '\n' " ${ glibcversion } " | sort -V | head -n 1) " != " ${ glibc } " ] ; then
elif [ " $( printf '%s\n' " ${ glibc } " " ${ glibcversion } " | sort -V | head -n 1) " != " ${ glibc } " ] ; then
fn_print_dots "Checking glibc"
fn_print_error_nl "Checking glibc: requirements not met"
fn_script_log_error "Checking glibc: requirements not met"
@ -49,7 +49,7 @@ if [ -n "${glibc}" ]; then
:
elif [ -z " ${ glibc } " ] ; then
echo -e " ${ lightblue } glibc required:\t ${ red } UNKNOWN ${ default } "
elif [ " $( printf '%s\n' ${ glibc } '\n' ${ glibcversion } | sort -V | head -n 1) " != " ${ glibc } " ] ; then
elif [ " $( printf '%s\n' " ${ glibc } " " ${ glibcversion } " | sort -V | head -n 1) " != " ${ glibc } " ] ; then
echo -e " ${ lightblue } glibc required:\t ${ red } ${ glibc } ${ default } ( ${ red } distro glibc ${ glibcversion } too old ${ default } ) "
else
echo -e " ${ lightblue } glibc required:\t ${ green } ${ glibc } ${ default } "
@ -249,9 +249,9 @@ echo -e "${bold}${lightyellow}Query Port (${queryport}) - TCP Output${default}"
fn_messages_separator
echo -e ""
for queryip in " ${ queryips [@] } " ; do
echo -e " ${ italic } bash -c 'exec 3<> /dev/tcp/' ${ queryip } '/' ${ queryport } '' ${ default } "
echo -e " ${ italic } bash -c 'exec 3<> /dev/tcp/'\" ${ queryip } \" '/'\" ${ queryport } \" ''${ default } "
echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/' ${ queryip } '/' ${ queryport } ''
timeout 3 bash -c 'exec 3<> /dev/tcp/' " ${ queryip } " '/' " ${ queryport } " ''
querystatus = " $? "
echo -e ""
if [ " ${ querystatus } " = = "0" ] ; then
@ -268,9 +268,9 @@ echo -e "${lightgreen}TCP Raw Output${default}"
fn_messages_separator
echo -e ""
for queryip in " ${ queryips [@] } " ; do
echo -e " ${ italic } bash -c 'exec 3<> /dev/tcp/' ${ queryip } '/' ${ port } '' ${ default } "
echo -e " ${ italic } bash -c 'exec 3<> /dev/tcp/'\" ${ queryip } \" '/'\" ${ port } \" ''${ default } "
echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/' ${ queryip } '/' ${ port } ''
timeout 3 bash -c 'exec 3<> /dev/tcp/' " ${ queryip } " '/' " ${ port } " ''
querystatus = " $? "
echo -e ""
if [ " ${ querystatus } " = = "0" ] ; then
@ -47,7 +47,7 @@ while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do
echo -e " ${ displayedmodname } - ${ displayedmoddescription } - ${ displayedmodsite } "
echo -e " * ${ cyan } ${ displayedmodcommand } ${ default } "
# Increment index from the amount of values we just displayed.
let "compatiblemodslistindex+=4"
( ( compatiblemodslistindex += 4) )
( ( totalmodsavailable++) )
done
@ -61,16 +61,29 @@ fn_script_log_info "${totalmodsavailable} addons/mods are available for install"
## User selects a mod.
echo -e ""
while [ [ ! " ${ availablemodscommands [@] } " = ~ " ${ usermodselect } " ] ] ; do
while :; do
echo -en " Enter an ${ cyan } addon/mod ${ default } to ${ green } install ${ default } (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort.
if [ " ${ usermodselect } " = = "exit" ] || [ " ${ usermodselect } " = = "abort" ] ; then
core_exit.sh
# Supplementary output upon invalid user input.
elif [ [ ! " ${ availablemodscommands [@] } " = ~ " ${ usermodselect } " ] ] ; then
fn_print_error2_nl " ${ usermodselect } is not a valid addon/mod. "
fi
validselection = 0
for availablemodcommand in " ${ availablemodscommands [@] } " ; do
if [ " ${ availablemodcommand } " = = " ${ usermodselect } " ] ; then
validselection = 1
break
fi
done
if [ " ${ validselection } " -eq 1 ] ; then
break
fi
# Supplementary output upon invalid user input.
fn_print_error2_nl " ${ usermodselect } is not a valid addon/mod. "
done
# Get mod info.
currentmod = " ${ usermodselect } "
@ -32,16 +32,29 @@ done
echo -e ""
# Keep prompting as long as the user input doesn't correspond to an available mod.
while [ [ ! " ${ installedmodslist [@] } " = ~ " ${ usermodselect } " ] ] ; do
while :; do
echo -en " Enter an ${ cyan } addon/mod ${ default } to ${ red } remove ${ default } (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort.
if [ " ${ usermodselect } " = = "exit" ] || [ " ${ usermodselect } " = = "abort" ] ; then
core_exit.sh
# Supplementary output upon invalid user input.
elif [ [ ! " ${ availablemodscommands [@] } " = ~ " ${ usermodselect } " ] ] ; then
fn_print_error2_nl " ${ usermodselect } is not a valid addon/mod. "
fi
validselection = 0
for installedmodcommand in " ${ installedmodslist [@] } " ; do
if [ " ${ installedmodcommand } " = = " ${ usermodselect } " ] ; then
validselection = 1
break
fi
done
if [ " ${ validselection } " -eq 1 ] ; then
break
fi
# Supplementary output upon invalid user input.
fn_print_error2_nl " ${ usermodselect } is not a valid addon/mod. "
done
fn_print_warning_nl " You are about to remove ${ cyan } ${ usermodselect } ${ default } . "