diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-02-25 21:35:12 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-02-25 22:12:43 +0000 |
commit | 7d32051b5114160c66c354972f8a64a00d331c6c (patch) | |
tree | 06e6a60d9468d159cb4bd52a79581315ff8bcea8 /src/backend/mirrors.py | |
parent | 17b776830e4468080c1b0f09685b4aa4f7b9eaf3 (diff) |
rename some functionsv6.2402.0
Diffstat (limited to 'src/backend/mirrors.py')
-rw-r--r-- | src/backend/mirrors.py | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/backend/mirrors.py b/src/backend/mirrors.py deleted file mode 100644 index 83d83f1..0000000 --- a/src/backend/mirrors.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python3 - -import sisyphus.getfs - - -def getList(): - mirrorList = [] - - with open(sisyphus.getfs.mirrorCfg) as mirrorFile: - for line in mirrorFile.readlines(): - if 'PORTAGE_BINHOST=' in line: - url = line.split("=")[1].replace('"', '').rstrip() - mirror = {'isActive': True, 'Url': url} - if line.startswith('#'): - mirror['isActive'] = False - mirrorList.append(mirror) - mirrorFile.close() - - return mirrorList - - -def printList(): - mirrorList = getList() - - for i, line in enumerate(mirrorList): - if line['isActive']: - print(i + 1, '*', line['Url']) - else: - print(i + 1, ' ', line['Url']) - - -def writeList(mirrorList): - with open(sisyphus.getfs.mirrorCfg, 'w+') as mirrorFile: - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Support for multiple mirrors is somewhat incomplete #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Please avoid using the Main Repository #\n") - mirrorFile.write( - "# http://mirrors.redcorelinux.org/redcorelinux #\n") - mirrorFile.write( - "# as the bandwidth is limited, use mirrors instead #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Uncomment only one mirror from the list bellow #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write("\n") - for line in mirrorList: - mirror = 'PORTAGE_BINHOST=' + '"' + line['Url'] + '"' - if not line['isActive']: - mirror = '# ' + mirror - mirrorFile.write(mirror + "\n") - mirrorFile.write("\n") - - -def setActive(mirror): - mirrorList = getList() - if mirror not in range(1, len(mirrorList) + 1): - print("\n" + "Mirror index is wrong, please check with sisyphus mirror list" + "\n") - else: - for i in range(0, len(mirrorList)): - indx = i + 1 - if indx == mirror: - mirrorList[i]['isActive'] = True - else: - mirrorList[i]['isActive'] = False - writeList(mirrorList) |