mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-05 05:58:06 +02:00
user check
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
#!/bin/bash
|
||||
#CyberPanel Upgrade script
|
||||
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
SUDO_TEST=$(set)
|
||||
SERVER_OS='Undefined'
|
||||
OUTPUT=$(cat /etc/*release)
|
||||
|
||||
check_root() {
|
||||
echo -e "\nChecking root privileges...\n"
|
||||
if echo $SUDO_TEST | grep SUDO > /dev/null ; then
|
||||
echo -e "\nYou are using SUDO , please run as root user...\n"
|
||||
echo -e "If you don't have direct access to root user, please run \e[31msudo su -\e[39m command and then run upgrade command again."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $(id -u) != 0 ]] > /dev/null; then
|
||||
echo -e "\nYou must use root user to upgrade CyberPanel...\n"
|
||||
exit
|
||||
else
|
||||
echo -e "\nYou are runing as root...\n"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
check_return() {
|
||||
#check previous command result , 0 = ok , non-0 = something wrong.
|
||||
if [[ $? -eq "0" ]] ; then
|
||||
@@ -13,6 +33,8 @@ else
|
||||
fi
|
||||
}
|
||||
|
||||
check_root
|
||||
|
||||
echo -e "\nChecking OS..."
|
||||
OUTPUT=$(cat /etc/*release)
|
||||
if echo $OUTPUT | grep -q "CentOS Linux 7" ; then
|
||||
|
||||
Reference in New Issue
Block a user