Skip to content

Commit

Permalink
fix: run check_root
Browse files Browse the repository at this point in the history
check root was never running because of logic in linuxgsm.sh
  • Loading branch information
dgibbs64 committed Oct 15, 2023
1 parent c947afb commit 83d3fb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lgsm/modules/check_root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

if [ "$(whoami)" == "root" ]; then
if [ "${commandname}" != "INSTALL" ]; then
fn_print_fail_nl "Do NOT run this script as root!"
fn_print_fail_nl "Do NOT run as root!"
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fail "${selfname} attempted to run as root."
else
Expand Down
19 changes: 9 additions & 10 deletions linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn_install_file() {
echo -e "Installed ${gamename} server as ${local_filename}"
echo -e ""
if [ ! -d "${serverfiles}" ]; then
echo -e "./${local_filename} install"
echo -e "./${local_filename} install"Do NOT run as root!
else
echo -e "Remember to check server ports"
echo -e "./${local_filename} details"
Expand All @@ -323,17 +323,16 @@ fn_install_file() {

# Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then
if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then
if [ "${shortname}" == "core" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1
if [ -f "${modulesdir}/core_modules.sh" ] || [ -f "${modulesdir}/check_root.sh" ] || [ -f "${modulesdir}/core_messages.sh" ]; then
if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then
core_modules.sh
check_root.sh
fi
elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1
else
core_modules.sh
check_root.sh
if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then
echo -e "[ FAIL ] Do NOT run as root!"
exit 1
fi
fi
fi

Expand Down

0 comments on commit 83d3fb8

Please sign in to comment.