Skip to content

Commit 299fca9

Browse files
committed
Updated restic installer for Centos7/8 to copr in incbackups and install.py for #580
1 parent 3a839e1 commit 299fca9

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

IncBackups/IncBackupsControl.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -863,30 +863,17 @@ def createBackup(self):
863863
command = 'restic'
864864
if ProcessUtilities.outputExecutioner(command).find('restic is a backup program which') == -1:
865865
try:
866+
866867
CentOSPath = '/etc/redhat-release'
867868

868869
if os.path.exists(CentOSPath):
869-
import platform
870-
distro = 'centos'
871-
release = platform.uname().release
872-
873-
url = 'https://api.github.com/repos/restic/restic/releases/latest'
874-
releases = json.loads(str(requests.get(url).text))
875-
version = releases['tag_name'].strip('v')
876-
download_url = f'https://github.com/restic/restic/releases/download/v{version}/restic_{version}_linux_amd64.bz2'
877-
ResticArchivePath = f'/root/restic_{version}_linux_amd64.bz2'
878-
ResticBinPath = '/usr/local/bin/restic'
879-
880-
if distro == 'centos' and 'el7' in release:
881-
command = 'yum install restic -y'
882-
ProcessUtilities.executioner(command)
883-
elif distro == 'centos' and 'el8' in release:
884-
command = 'wget -O %s %s' % (ResticArchivePath, download_url)
870+
command = 'yum install -y yum-plugin-copr'
885871
ProcessUtilities.executioner(command)
886-
command = 'bzip2 -dc %s > %s' % (ResticArchivePath, ResticBinPath)
872+
command = 'yum copr enable -y copart/restic'
887873
ProcessUtilities.executioner(command)
888-
command = 'chmod +x %s' % ResticBinPath
874+
command = 'yum install -y restic'
889875
ProcessUtilities.executioner(command)
876+
890877
else:
891878
command = 'apt-get update -y'
892879
ProcessUtilities.executioner(command)
@@ -898,7 +885,7 @@ def createBackup(self):
898885
logging.statusWriter(self.statusPath,
899886
'It seems restic is not installed, for incremental backups to work '
900887
'restic must be installed. You can manually install restic using this '
901-
'guide -> http://go.cyberpanel.net/restic. [5009]', 1)
888+
'guide -> https://go.cyberpanel.net/restic. [5009]', 1)
902889
pass
903890

904891
return 0

install/install.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,25 +2030,11 @@ def installRestic(self):
20302030
CentOSPath = '/etc/redhat-release'
20312031

20322032
if os.path.exists(CentOSPath):
2033-
2034-
if self.distro == centos:
2035-
command = 'yum install restic -y'
2033+
command = 'yum install -y yum-plugin-copr'
20362034
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
2037-
elif self.distro == cent8:
2038-
2039-
command = 'cat /proc/cpuinfo'
2040-
2041-
result = subprocess.check_output(shlex.split(command)).decode("utf-8")
2042-
2043-
if result.find('ARM') > -1 or result.find('arm') > -1:
2044-
command = 'wget -O /usr/bin/restic https://rep.cyberpanel.net/restic_0.9.6_linux_arm64'
2045-
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
2046-
2047-
else:
2048-
command = 'wget -O /usr/bin/restic https://rep.cyberpanel.net/restic_0.9.6_linux_amd64'
2049-
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
2050-
2051-
command = 'chmod +x /usr/bin/restic'
2035+
command = 'yum copr enable -y copart/restic'
2036+
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
2037+
command = 'yum install -y restic'
20522038
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
20532039

20542040
else:

0 commit comments

Comments
 (0)