More syntax stuff

This commit is contained in:
rperper
2018-10-26 09:52:07 -04:00
parent 4d18ef40a7
commit 454d680d33
3 changed files with 25 additions and 13 deletions

View File

@@ -21,7 +21,9 @@ apt-get install curl -y
#tar xzvf install.tar.gz #tar xzvf install.tar.gz
apt-get install python -y apt-get install python -y
apt-get install git -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 cyberpanel
cd install cd install
chmod +x install.py chmod +x install.py

9
install.sh Normal file → Executable file
View File

@@ -1,4 +1,13 @@
#!/bin/bash #!/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 yum autoremove epel-release -y
rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo
rm -f /etc/yum.repos.d/epel.repo.rpmsave rm -f /etc/yum.repos.d/epel.repo.rpmsave

21
install/install.py Normal file → Executable file
View File

@@ -18,7 +18,6 @@ from stat import *
centos=0 centos=0
ubuntu=1 ubuntu=1
distro = centos
class preFlightsChecks: class preFlightsChecks:
@@ -50,7 +49,7 @@ class preFlightsChecks:
os._exit(0) os._exit(0)
def setup_account_cyberpanel(self): def setup_account_cyberpanel(self):
self.stdOut("Setup Cyberpanel account") self.stdOut("Setup Cyberpanel account, distro: " + str(self.distro))
try: try:
count = 0 count = 0
@@ -77,6 +76,7 @@ class preFlightsChecks:
count = 0 count = 0
if distro == ubuntu: if distro == ubuntu:
self.stdOut("Add Cyberpanel user")
command = "useradd cyberpanel -g sudo" command = "useradd cyberpanel -g sudo"
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -148,7 +148,7 @@ class preFlightsChecks:
############################### ###############################
count = 0 count = 0
self.stdOut("Create /etc/letsencrypt directory")
while (1): while (1):
command = "mkdir /etc/letsencrypt" command = "mkdir /etc/letsencrypt"
@@ -2526,7 +2526,7 @@ class preFlightsChecks:
try: try:
count = 0 count = 0
while (1): while (1):
if distro == centos if distro == centos:
command = 'yum -y install rsync' command = 'yum -y install rsync'
else: else:
command = 'apt-get -y install rsync' command = 'apt-get -y install rsync'
@@ -3086,20 +3086,17 @@ milter_default_action = accept
def get_distro(): def get_distro():
distro = -1 distro = centos
distro_file = "" distro_file = ""
if exists("/etc/lsb-release"): if exists("/etc/lsb-release"):
distro_file = "/etc/lsb-release" distro_file = "/etc/lsb-release"
with open(distro_file) as f: with open(distro_file) as f:
for line in f: for line in f:
if line == "DISTRIB_ID=Ubuntu": if line == "DISTRIB_ID=Ubuntu\n":
distro = ubuntu distro = ubuntu
elif exists("/etc/os-release"): elif exists("/etc/os-release"):
distro_file = "/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: else:
@@ -3131,7 +3128,10 @@ def main():
## Writing public IP ## Writing public IP
try:
os.mkdir("/etc/cyberpanel") os.mkdir("/etc/cyberpanel")
except:
pass
machineIP = open("/etc/cyberpanel/machineIP", "w") machineIP = open("/etc/cyberpanel/machineIP", "w")
machineIP.writelines(args.publicip) machineIP.writelines(args.publicip)
@@ -3140,6 +3140,7 @@ def main():
cwd = os.getcwd() cwd = os.getcwd()
distro = get_distro() distro = get_distro()
preFlightsChecks.stdOut("Distro: " + str(distro))
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP", distro) checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP", distro)
if distro == ubuntu: if distro == ubuntu:
@@ -3236,6 +3237,6 @@ def main():
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
if __name__ == "__main"_: if __name__ == "__main__":
main() main()