Browse Source

fix: run check_root

check root was never running because of logic in linuxgsm.sh
pull/4339/head
Daniel Gibbs 2 years ago
parent
commit
f5d36494f6
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 2
      lgsm/modules/check_root.sh
  2. 19
      linuxgsm.sh

2
lgsm/modules/check_root.sh

@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "$(whoami)" == "root" ]; then if [ "$(whoami)" == "root" ]; then
if [ "${commandname}" != "INSTALL" ]; 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 if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fail "${selfname} attempted to run as root." fn_script_log_fail "${selfname} attempted to run as root."
else else

19
linuxgsm.sh

@ -323,17 +323,18 @@ fn_install_file() {
# Prevent LinuxGSM from running as root. Except if doing a dependency install. # Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then if [ "$(whoami)" == "root" ]; then
if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then if [ -f "${modulesdir}/core_modules.sh" ] || [ -f "${modulesdir}/check_root.sh" ] || [ -f "${modulesdir}/core_messages.sh" ]; then
if [ "${shortname}" == "core" ]; then if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" core_modules.sh
exit 1 core_messages.sh
fn_ansi_loader
check_root.sh
fi 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 else
core_modules.sh if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then
check_root.sh echo -e "[ FAIL ] Do NOT run as root!"
exit 1
fi
fi fi
fi fi

Loading…
Cancel
Save