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
No known key found for this signature in database
GPG Key ID: 2076B128385E8C55
2 changed files with
11 additions and
10 deletions
-
lgsm/modules/check_root.sh
-
linuxgsm.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 |
|
|
|
|
|
@ -323,18 +323,19 @@ 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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
else |
|
|
|
if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then |
|
|
|
echo -e "[ FAIL ] Do NOT run as root!" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
# LinuxGSM installer mode. |
|
|
|