|
@@ -4,7 +4,7 @@
|
|
|
# Prevent 'tput' errors when running from Cron
|
|
|
[[ -z $TERM || $TERM == "unknown" || $TERM == "dumb" ]] && export TERM=dumb
|
|
|
|
|
|
-readonly app_version="1.16.6"
|
|
|
+readonly app_version="1.16.7"
|
|
|
readonly svr_version="1.7"
|
|
|
readonly os_ubuntu_supported=(bionic focal jammy) # https://ubuntu.com/about/release-cycle
|
|
|
readonly php_supported=(7.4 8.0 8.1) # https://www.php.net/supported-versions.php
|
|
@@ -23,27 +23,6 @@ readonly bol=`tput bold`
|
|
|
readonly dim=`tput dim`
|
|
|
|
|
|
|
|
|
-# Check for BASH Shell
|
|
|
-# This is a very "shity" method, but checking if file exists is very reliable
|
|
|
-# If modified: this same script is in installer, general lib and verify
|
|
|
-if [[ -n $(echo $(tty) | grep -Eo "pts/[0-9]+") && -n $(logname) ]]; then
|
|
|
- shell_pid=$(ps -au | grep -E "^$(logname).*pts/[0-9]+[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
|
|
- [[ -n $shell_pid && -f /proc/$shell_pid/cmdline ]] && shell_current=$(tr -d '\000' < /proc/$shell_pid/cmdline)
|
|
|
- [[ -n $shell_pid && -f /proc/$shell_pid/status ]] && shell_status=$(grep -Eo '^Name:.*bash.*' /proc/$shell_pid/status) # Double check!!!
|
|
|
-
|
|
|
- if [[ -n $shell_current && $shell_current != *"bash"* && -z $shell_status ]]; then
|
|
|
- echo "${red}BASH Shell is required! ${dim}(${shell_current}) ${end}"
|
|
|
- exit 1
|
|
|
- fi
|
|
|
-fi
|
|
|
-
|
|
|
-# STOP and exit if not root or sudo.
|
|
|
-if [[ $(whoami) != "root" ]]; then
|
|
|
- echo "${red}Please run this script as root or using sudo.${end}"
|
|
|
- exit 1
|
|
|
-fi
|
|
|
-
|
|
|
-
|
|
|
# ***********************************************
|
|
|
# Configuration Management Functions **********
|
|
|
# ***********************************************
|
|
@@ -97,6 +76,26 @@ ADMIN_PASS=$( echo $(conf_read mysql-admin) | openssl enc -d -a -salt )
|
|
|
readonly CURRENT_HOME=$(eval echo ~${SUDO_USER:-${USER}})
|
|
|
readonly CURRENT_USER=${SUDO_USER:-${USER}}
|
|
|
|
|
|
+# Check for BASH Shell
|
|
|
+# This is a very "shity" method, but checking if file exists is very reliable
|
|
|
+# If modified: this same script is in installer, general lib and verify
|
|
|
+if [[ $(conf_read shell-check) != "false" && -n $(echo $(tty) | grep -Eo "pts/[0-9]+") && -n $(logname) ]]; then
|
|
|
+ pre_pid=$(ps -au | grep -E "pts/[0-9]+[ ]+S[s]?[ ]+" | sed '/sudo/d' | tail -n 1)
|
|
|
+ [[ -n $pre_pid ]] && shell_pid=$(echo $pre_pid | awk '{print $2}')
|
|
|
+ [[ -n $shell_pid && -f /proc/$shell_pid/cmdline ]] && shell_current=$(tr -d '\000' < /proc/$shell_pid/cmdline)
|
|
|
+ [[ -n $shell_pid && -f /proc/$shell_pid/status ]] && shell_status=$(grep -Eo '^Name:.*bash.*' /proc/$shell_pid/status) # Double check!!!
|
|
|
+
|
|
|
+ if [[ -n $shell_current && $shell_current != *"bash"* && -z $shell_status ]]; then
|
|
|
+ echo "${red}[WARNING] Seems like you are using an interactive shell different than BASH! ${dim}($(echo $pre_pid | awk '{print $1}'):${shell_current}) ${end}"
|
|
|
+ fi
|
|
|
+fi
|
|
|
+
|
|
|
+# STOP and exit if not root or sudo.
|
|
|
+if [[ $(whoami) != "root" ]]; then
|
|
|
+ echo "${red}Please run this script as root or using sudo.${end}"
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
|
|
|
# ***********************************************
|
|
|
# General Functions ***************************
|