From 0c181739017132352ee4f71b09063186a239cf91 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 17 Dec 2019 21:34:55 +0500 Subject: [PATCH] cent8 init --- cyberpanel.sh | 26 ++++++++++++++++++++------ install/install.py | 11 +++++++++-- plogical/backupSchedule.py | 4 ++-- plogical/modSec.py | 2 ++ plogical/remoteTransferUtilities.py | 5 ++--- plogical/tuning.py | 2 ++ tuning/tuning.py | 2 -- 7 files changed, 37 insertions(+), 15 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 4f6d974cb..2e4c83411 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -338,11 +338,20 @@ if [[ $SERVER_OS == "CentOS" ]] ; then yum update -y yum install epel-release -y yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git + + if [[ $CENT_8 == "True" ]] ; then + yum -y install platform-python-devel + dnf --enablerepo=PowerTools install gpgme-devel -y + yum -y install python3-pip + fi + if [[ $DEV == "ON" ]] ; then - yum -y install yum-utils - yum -y groupinstall development - yum -y install https://centos7.iuscommunity.org/ius-release.rpm - yum -y install python36u python36u-pip python36u-devel + if [[ $CENT_8 == "False" ]] ; then + yum -y install yum-utils + yum -y groupinstall development + yum -y install https://centos7.iuscommunity.org/ius-release.rpm + yum -y install python36u python36u-pip python36u-devel + fi fi fi @@ -470,10 +479,11 @@ fi } - +CENT_8="False" check_OS() { echo -e "\nChecking OS..." OUTPUT=$(cat /etc/*release) + if echo $OUTPUT | grep -q "CentOS Linux 7" ; then echo -e "\nDetecting CentOS 7.X...\n" SERVER_OS="CentOS" @@ -483,11 +493,15 @@ elif echo $OUTPUT | grep -q "CloudLinux 7" ; then elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then echo -e "\nDetecting Ubuntu 18.04...\n" SERVER_OS="Ubuntu" +elif echo $OUTPUT | grep -q "CentOS Linux 7" ; then + echo -e "\nDetecting Ubuntu 18.04...\n" + SERVER_OS="Centos8" + CENT_8="True" else cat /etc/*release 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 +# exit 1 fi } diff --git a/install/install.py b/install/install.py index 0cb441e9f..2f49760d2 100755 --- a/install/install.py +++ b/install/install.py @@ -32,6 +32,7 @@ def generate_pass(length=14): centos = 0 ubuntu = 1 +cent8 = 2 def get_distro(): @@ -48,6 +49,11 @@ def get_distro(): distro_file = "/etc/os-release" distro = centos + data = open('/etc/redhat-release', 'r').read() + + if data.find('CentOS Linux release 8') > -1: + return cent8 + else: logging.InstallLog.writeToFile("Can't find linux release file - fatal error") preFlightsChecks.stdOut("Can't find linux release file - fatal error") @@ -365,10 +371,11 @@ class preFlightsChecks: self.stdOut("Install pip") if self.distro == ubuntu: command = "apt-get -y install python-pip" - else: + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + elif self.distro == centos: command = "yum -y install python-pip" + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) def install_python_dev(self): self.stdOut("Install python development environment") diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index c839f20b4..c49c6ac6a 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -5,14 +5,14 @@ import django sys.path.append('/usr/local/CyberCP') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") django.setup() -from . import CyberCPLogFileWriter as logging +from plogical import CyberCPLogFileWriter as logging import subprocess import shlex import os import time from plogical.backupUtilities import backupUtilities from re import match,I,M -from websiteFunctions.models import Websites, Backups +from websiteFunctions.models import Backups from plogical.processUtilities import ProcessUtilities from random import randint import json, requests diff --git a/plogical/modSec.py b/plogical/modSec.py index f763a837a..6c4e86c6f 100755 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -1,3 +1,5 @@ +import sys +sys.path.append('/usr/local/CyberCP') from plogical import CyberCPLogFileWriter as logging import subprocess import shlex diff --git a/plogical/remoteTransferUtilities.py b/plogical/remoteTransferUtilities.py index 32e098b43..e3a23831d 100755 --- a/plogical/remoteTransferUtilities.py +++ b/plogical/remoteTransferUtilities.py @@ -1,18 +1,17 @@ import argparse import os +import sys +sys.path.append('/usr/local/CyberCP') from plogical import CyberCPLogFileWriter as logging from plogical import backupUtilities as backupUtil import time from multiprocessing import Process -import json -import requests import subprocess import shlex from shutil import move from plogical.virtualHostUtilities import virtualHostUtilities from plogical.processUtilities import ProcessUtilities from plogical.backupSchedule import backupSchedule -import shutil class remoteTransferUtilities: diff --git a/plogical/tuning.py b/plogical/tuning.py index 2e129bf37..e146a0d28 100755 --- a/plogical/tuning.py +++ b/plogical/tuning.py @@ -1,3 +1,5 @@ +import sys +sys.path.append('/usr/local/CyberCP') from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from plogical.installUtilities import installUtilities import argparse diff --git a/tuning/tuning.py b/tuning/tuning.py index cf5d80628..74eedbeed 100755 --- a/tuning/tuning.py +++ b/tuning/tuning.py @@ -12,8 +12,6 @@ import plogical.CyberCPLogFileWriter as logging from plogical.tuning import tuning from loginSystem.views import loadLoginPage from plogical.virtualHostUtilities import virtualHostUtilities -import subprocess -import shlex from plogical.acl import ACLManager from plogical.processUtilities import ProcessUtilities