From c7c7559a87120c7e25366f63ded52759a8cf0aba Mon Sep 17 00:00:00 2001 From: Bogdan Ilisei Date: Tue, 3 Mar 2020 22:47:22 +0200 Subject: [PATCH 1/3] Fixed --password issue This fixes the length check for the argument length supplied to `--password`, specifically: `./cyberpanel.sh: line 1554: [: testpassw0rd: integer expression expected` --- cyberpanel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 14afc9e2d..95a97e04c 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1555,7 +1555,7 @@ else elif [[ "${1}" == 'r' ]] || [[ $1 == 'random' ]] ; then ADMIN_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo '') else - if [ ${1} -lt 8 ] ; then + if [ ${#1} -lt 8 ] ; then echo -e "\nPassword lenth less than 8 digital, please choose a more complicated password.\n" exit fi From eb0f6229a7b91a8d0657461b869cf5a434d67963 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Wed, 4 Mar 2020 00:58:27 +0100 Subject: [PATCH 2/3] Create install.sh --- install.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 000000000..a517e0d0e --- /dev/null +++ b/install.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +OUTPUT=$(cat /etc/*release) +if echo $OUTPUT | grep -q "CentOS Linux 7" ; then + echo "Checking and installing curl and wget" +yum install curl wget -y 1> /dev/null +yum update curl wget ca-certificates -y 1> /dev/null + SERVER_OS="CentOS" +elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then + echo -e "\nDetecting Centos 8...\n" + SERVER_OS="CentOS8" +yum install curl wget -y 1> /dev/null +yum update curl wget ca-certificates -y 1> /dev/null +elif echo $OUTPUT | grep -q "CloudLinux 7" ; then + echo "Checking and installing curl and wget" +yum install curl wget -y 1> /dev/null +yum update curl wget ca-certificates -y 1> /dev/null + SERVER_OS="CloudLinux" +elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then +apt install -y -qq wget curl + SERVER_OS="Ubuntu" +else + echo -e "\nUnable to detect your OS...\n" + echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x and CloudLinux 7.x...\n" + exit 1 +fi + +rm -f cyberpanel.sh +rm -f install.tar.gz +curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null +chmod +x cyberpanel.sh +./cyberpanel.sh $@ From 4c330eda9d849d8e26c8d9cea552d3d0ce54b432 Mon Sep 17 00:00:00 2001 From: Bogdan Ilisei Date: Wed, 4 Mar 2020 14:06:49 +0200 Subject: [PATCH 3/3] Rewriting install.sh Putting some make-up on the install.sh script" - This relies on the `/etc/os-release` file which is present on all modern distributions that you are currently supporting. More info on: https://www.freedesktop.org/software/systemd/man/os-release.html - I've taken the liberty of including a warning message for CentOS 8 / CloudLinux 8 - I've also derived `SERVER_OS` from the proper strings. I suggest you end up using a variable directly from `/etc/os-release` instead, tough, as it's just extra-fluff right now, and it seems you are using it just for statistics purposes - I have also switched to using `printf >&2` to output the messages to `stderr` instead of `stdout` because they are technically warnings --- install.sh | 58 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/install.sh b/install.sh index a517e0d0e..903bac16d 100644 --- a/install.sh +++ b/install.sh @@ -1,32 +1,38 @@ #!/bin/sh -OUTPUT=$(cat /etc/*release) -if echo $OUTPUT | grep -q "CentOS Linux 7" ; then - echo "Checking and installing curl and wget" -yum install curl wget -y 1> /dev/null -yum update curl wget ca-certificates -y 1> /dev/null - SERVER_OS="CentOS" -elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then - echo -e "\nDetecting Centos 8...\n" - SERVER_OS="CentOS8" -yum install curl wget -y 1> /dev/null -yum update curl wget ca-certificates -y 1> /dev/null -elif echo $OUTPUT | grep -q "CloudLinux 7" ; then - echo "Checking and installing curl and wget" -yum install curl wget -y 1> /dev/null -yum update curl wget ca-certificates -y 1> /dev/null - SERVER_OS="CloudLinux" -elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then -apt install -y -qq wget curl - SERVER_OS="Ubuntu" +if [ -f "/etc/os-release" ]; then + . /etc/os-release else - echo -e "\nUnable to detect your OS...\n" - echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x and CloudLinux 7.x...\n" - exit 1 + ID="unsupported" + PRETTY_NAME="Your OS does not have a /etc/os-release file" fi -rm -f cyberpanel.sh -rm -f install.tar.gz -curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null +if [ "$ID" = "ubuntu" ] && [ "$UBUNTU_CODENAME" = "bionic" ]; then + export DEBIAN_FRONTEND=noninteractive + apt -q -y -o Dpkg::Options::=--force-confnew update + apt -q -y -o Dpkg::Options::=--force-confnew install wget curl + SERVER_OS="$NAME" +elif [ "$ID" = "centos" ] || [ "$ID" = "cloudlinux" ]; then + case "$VERSION_ID" in + 7|7.*) + yum install curl wget -y 1> /dev/null + yum update curl wget ca-certificates -y 1> /dev/null + SERVER_OS="$NAME" + ;; + 8|8.*) + printf >&2 '\nCentOS 8/CloudLinux 8 support is currently experimental!\n' + yum install curl wget -y 1> /dev/null + yum update curl wget ca-certificates -y 1> /dev/null + SERVER_OS="${NAME}${VERSION_ID}" + ;; + esac +else + printf >&2 '\nYour OS -- %s -- is not currently supported!\n' "$PRETTY_NAME" + printf >&2 '\nCyberPanel is currently supported on Ubuntu 18.04, CentOS 7 and CloudLinux 7.\n' + exit 1 +fi + +rm -f cyberpanel.sh install.tar.gz +curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&${SERVER_OS}" 2>/dev/null chmod +x cyberpanel.sh -./cyberpanel.sh $@ +./cyberpanel.sh "$@"