mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
Updated with new logic to install restic from latest release source for centos for https://github.com/usmannasir/cyberpanel/issues/580
This commit is contained in:
@@ -4,7 +4,7 @@ import os.path
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import requests
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
|
||||
@@ -869,25 +869,24 @@ Subject: %s
|
||||
import platform
|
||||
distro = 'centos'
|
||||
release = platform.uname().release
|
||||
|
||||
url = 'https://api.github.com/repos/restic/restic/releases/latest'
|
||||
releases = json.loads(str(requests.get(url).text))
|
||||
version = releases['tag_name'].strip('v')
|
||||
download_url = f'https://github.com/restic/restic/releases/download/v{version}/restic_{version}_linux_amd64.bz2'
|
||||
ResticArchivePath = f'/root/restic_{version}_linux_amd64.bz2'
|
||||
ResticBinPath = '/usr/local/bin/restic'
|
||||
|
||||
if distro == 'centos' and 'el7' in release:
|
||||
command = 'yum install restic -y'
|
||||
ProcessUtilities.executioner(command)
|
||||
elif distro == 'centos' and 'el8' in release:
|
||||
command = 'cat /proc/cpuinfo'
|
||||
|
||||
result = subprocess.check_output(shlex.split(command)).decode("utf-8")
|
||||
|
||||
if result.find('ARM') > -1 or result.find('arm') > -1:
|
||||
command = 'wget -O /usr/bin/restic https://rep.cyberpanel.net/restic_0.9.6_linux_arm64'
|
||||
command = 'wget -O %s %s' % (ResticArchivePath, download_url)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
else:
|
||||
command = 'wget -O /usr/bin/restic https://rep.cyberpanel.net/restic_0.9.6_linux_amd64'
|
||||
command = 'bzip2 -dc %s > %s' % (ResticArchivePath, ResticBinPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'chmod +x /usr/bin/restic'
|
||||
command = 'chmod +x %s' % ResticBinPath
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
else:
|
||||
command = 'apt-get update -y'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
@@ -269,7 +269,7 @@ class DNSManager:
|
||||
|
||||
if recordType == "A":
|
||||
|
||||
recordContentA = data['recordContentA'] ## IP or ponting value
|
||||
recordContentA = data['recordContentA'] ## IP or pointing value
|
||||
|
||||
if recordName == "@":
|
||||
value = zoneDomain
|
||||
@@ -309,7 +309,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentAAAA = data['recordContentAAAA'] ## IP or ponting value
|
||||
recordContentAAAA = data['recordContentAAAA'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentAAAA, 0, ttl)
|
||||
|
||||
@@ -324,7 +324,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentCNAME = data['recordContentCNAME'] ## IP or ponting value
|
||||
recordContentCNAME = data['recordContentCNAME'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentCNAME, 0, ttl)
|
||||
|
||||
@@ -339,7 +339,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentSPF = data['recordContentSPF'] ## IP or ponting value
|
||||
recordContentSPF = data['recordContentSPF'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentSPF, 0, ttl)
|
||||
|
||||
@@ -354,7 +354,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentTXT = data['recordContentTXT'] ## IP or ponting value
|
||||
recordContentTXT = data['recordContentTXT'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentTXT, 0, ttl)
|
||||
|
||||
@@ -404,7 +404,7 @@ class DNSManager:
|
||||
value = recordName
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
recordContentCAA = data['recordContentCAA'] ## IP or ponting value
|
||||
recordContentCAA = data['recordContentCAA'] ## IP or pointing value
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentCAA, 0, ttl)
|
||||
|
||||
final_dic = {'status': 1, 'add_status': 1, 'error_message': "None"}
|
||||
@@ -849,7 +849,7 @@ class DNSManager:
|
||||
|
||||
if recordType == "A":
|
||||
|
||||
recordContentA = data['recordContentA'] ## IP or ponting value
|
||||
recordContentA = data['recordContentA'] ## IP or pointing value
|
||||
|
||||
if recordName == "@":
|
||||
value = zoneDomain
|
||||
@@ -889,7 +889,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentAAAA = data['recordContentAAAA'] ## IP or ponting value
|
||||
recordContentAAAA = data['recordContentAAAA'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentAAAA, 0, ttl)
|
||||
|
||||
@@ -904,7 +904,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentCNAME = data['recordContentCNAME'] ## IP or ponting value
|
||||
recordContentCNAME = data['recordContentCNAME'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentCNAME, 0, ttl)
|
||||
|
||||
@@ -919,7 +919,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentSPF = data['recordContentSPF'] ## IP or ponting value
|
||||
recordContentSPF = data['recordContentSPF'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentSPF, 0, ttl)
|
||||
|
||||
@@ -934,7 +934,7 @@ class DNSManager:
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentTXT = data['recordContentTXT'] ## IP or ponting value
|
||||
recordContentTXT = data['recordContentTXT'] ## IP or pointing value
|
||||
|
||||
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentTXT, 0, ttl)
|
||||
|
||||
@@ -984,7 +984,7 @@ class DNSManager:
|
||||
value = recordName
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
recordContentCAA = data['recordContentCAA'] ## IP or ponting value
|
||||
recordContentCAA = data['recordContentCAA'] ## IP or pointing value
|
||||
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentCAA, 0, ttl)
|
||||
|
||||
final_dic = {'status': 1, 'add_status': 1, 'error_message': "None"}
|
||||
|
||||
Reference in New Issue
Block a user