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 [ "${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

19
linuxgsm.sh

@ -323,17 +323,18 @@ 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
core_messages.sh
fn_ansi_loader
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

Loading…
Cancel
Save