summaryrefslogtreecommitdiff
path: root/src/frontend/cli/sisyphus-cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/cli/sisyphus-cli.py')
-rwxr-xr-xsrc/frontend/cli/sisyphus-cli.py34
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:]: