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 /src/frontend/cli | |
parent | 4a29d2cc407753acd26197f2156f2afea913de11 (diff) |
add mirror selection to cli frontend
Diffstat (limited to 'src/frontend/cli')
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 34 |
1 files changed, 34 insertions, 0 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:]: |