diff --git a/install-ubuntu.sh b/install-ubuntu.sh index e0acf3bdc..3d2c3f074 100755 --- a/install-ubuntu.sh +++ b/install-ubuntu.sh @@ -21,7 +21,9 @@ apt-get install curl -y #tar xzvf install.tar.gz apt-get install python -y apt-get install git -y -#git clone https://github.com/rperper/cyberpanel.git +if [ ! -d cyberpanel ]; then + git clone https://github.com/rperper/cyberpanel.git +fi cd cyberpanel cd install chmod +x install.py diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index b923418cb..b0cecfc07 --- a/install.sh +++ b/install.sh @@ -1,4 +1,13 @@ #!/bin/bash +if [ -a /etc/lsb-release ]; then + if [ ! -x ./install-ubuntu.sh ]; then + echo "Download install-ubuntu.sh and make it executable" + exit 1 + fi + echo "Running Ubuntu install" + ./install-ubuntu.sh + exit $? +fi yum autoremove epel-release -y rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo.rpmsave diff --git a/install/install.py b/install/install.py old mode 100644 new mode 100755 index a33a84f04..be3017e62 --- a/install/install.py +++ b/install/install.py @@ -18,7 +18,6 @@ from stat import * centos=0 ubuntu=1 -distro = centos class preFlightsChecks: @@ -50,7 +49,7 @@ class preFlightsChecks: os._exit(0) def setup_account_cyberpanel(self): - self.stdOut("Setup Cyberpanel account") + self.stdOut("Setup Cyberpanel account, distro: " + str(self.distro)) try: count = 0 @@ -77,6 +76,7 @@ class preFlightsChecks: count = 0 if distro == ubuntu: + self.stdOut("Add Cyberpanel user") command = "useradd cyberpanel -g sudo" cmd = shlex.split(command) res = subprocess.call(cmd) @@ -148,7 +148,7 @@ class preFlightsChecks: ############################### count = 0 - + self.stdOut("Create /etc/letsencrypt directory") while (1): command = "mkdir /etc/letsencrypt" @@ -2526,7 +2526,7 @@ class preFlightsChecks: try: count = 0 while (1): - if distro == centos + if distro == centos: command = 'yum -y install rsync' else: command = 'apt-get -y install rsync' @@ -3086,21 +3086,18 @@ milter_default_action = accept def get_distro(): - distro = -1 + distro = centos distro_file = "" if exists("/etc/lsb-release"): distro_file = "/etc/lsb-release" with open(distro_file) as f: for line in f: - if line == "DISTRIB_ID=Ubuntu": + if line == "DISTRIB_ID=Ubuntu\n": distro = ubuntu elif exists("/etc/os-release"): distro_file = "/etc/os-release" - with open(distro_file) as f: - for line in f: - if line == "ID=\"centos\"": - distro = centos + distro = centos else: logging.InstallLog.writeToFile("Can't find linux release file - fatal error") @@ -3131,7 +3128,10 @@ def main(): ## Writing public IP - os.mkdir("/etc/cyberpanel") + try: + os.mkdir("/etc/cyberpanel") + except: + pass machineIP = open("/etc/cyberpanel/machineIP", "w") machineIP.writelines(args.publicip) @@ -3140,6 +3140,7 @@ def main(): cwd = os.getcwd() distro = get_distro() + preFlightsChecks.stdOut("Distro: " + str(distro)) checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP", distro) if distro == ubuntu: @@ -3236,6 +3237,6 @@ def main(): logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") -if __name__ == "__main"_: +if __name__ == "__main__": main()