diff options
author | bionel <ionel.busuioc@gmail.com> | 2018-03-25 11:52:28 +0300 |
---|---|---|
committer | bionel <ionel.busuioc@gmail.com> | 2018-03-25 11:52:28 +0300 |
commit | a40c32948f3064af491f1c20cf925b8f04758f30 (patch) | |
tree | 7df807b0d5d767cb2808cf5dd2d5f60194a4e573 | |
parent | 4a29d2cc407753acd26197f2156f2afea913de11 (diff) |
add mirror selection to cli frontend
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 34 | ||||
-rw-r--r-- | src/frontend/gui/mirrors.conf.sample | 4 |
2 files changed, 35 insertions, 3 deletions
diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index c8a8bd9..97e5017 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -5,6 +5,30 @@ from libsisyphus import * check_system_mode() +def listRepo(): + mirrorList = getMirrors() + for i, line in enumerate(mirrorList): + if line['isActive']: + print(i+1,'*',line['Url']) + else: + print(i+1,' ',line['Url']) + +def setRepo(mirror): + mirror = int(mirror[0]) + mirrorList = getMirrors() + newMirrorList = [] + if mirror not in range(1,len(mirrorList)+1): + print('mirror index is wrong, please check with "sisyphus mirror list"') + else: + for i, line in enumerate(mirrorList): + indx = i+1 + if indx == mirror : + line['isActive'] = True + else: + line['isActive'] = False + newMirrorList.append(line) + setActiveMirror(newMirrorList) + PKGLIST = sys.argv[2:] if "__main__" == __name__: @@ -28,6 +52,16 @@ if "__main__" == __name__: sisyphus_db_rescue() elif "sysinfo" in sys.argv[1:]: sisyphus_pkg_sysinfo() + elif "mirror" in sys.argv[1:]: + if not sys.argv[2:]: + sisyphus_pkg_help() + elif "list" in sys.argv[2]: + listRepo() + elif "set" in sys.argv[2:]: + if not sys.argv[3:]: + sisyphus_pkg_help() + else: + setRepo(sys.argv[3:]) elif "help" in sys.argv[1:]: sisyphus_pkg_help() elif not sys.argv[1:]: diff --git a/src/frontend/gui/mirrors.conf.sample b/src/frontend/gui/mirrors.conf.sample index 6be0b29..8180c87 100644 --- a/src/frontend/gui/mirrors.conf.sample +++ b/src/frontend/gui/mirrors.conf.sample @@ -3,11 +3,9 @@ # Uncomment only one mirror from the list bellow # ####################################################### -# Princeton University (USA) mirror # PORTAGE_BINHOST="http://mirror.math.princeton.edu/pub/redcorelinux/packages/" -# Alpix.eu (Germany) mirror PORTAGE_BINHOST="http://mirror.alpix.eu/redcorelinux/packages/" -# Yandex.ru (Russia) mirror # PORTAGE_BINHOST="http://mirror.yandex.ru/mirrors/redcorelinux/packages/" + |