python-apt: update mirror parser and add note
This commit is contained in:
parent
de1bcc6d6b
commit
e0f999388d
2 changed files with 18 additions and 1 deletions
|
|
@ -31,6 +31,10 @@ parser.add_argument(
|
|||
"-c",
|
||||
help="Filter by country (e.g., AU, BR, CA)",
|
||||
default=None)
|
||||
parser.add_argument(
|
||||
"--mirmon",
|
||||
action="store_true",
|
||||
help="List mirrors suitable for mirmon output")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file, 'r') as file:
|
||||
|
|
@ -67,13 +71,25 @@ for block in blocks:
|
|||
mirrors[country] = {}
|
||||
mirrors[country][site] = {"https": https_urls, "http": http_urls}
|
||||
|
||||
# Print mirmon output if selected
|
||||
if args.mirmon:
|
||||
for country, sites in sorted(mirrors.items()):
|
||||
if args.country and country != args.country:
|
||||
continue
|
||||
for site, urls in sites.items():
|
||||
if urls["https"]:
|
||||
print(f"{country.lower()} {urls['https'][0]}")
|
||||
elif urls["http"]:
|
||||
print(f"{country.lower()} {urls['http'][0]}")
|
||||
exit(0)
|
||||
|
||||
# Print output
|
||||
for country, sites in sorted(mirrors.items()):
|
||||
if args.country and country != args.country:
|
||||
continue
|
||||
|
||||
valid_sites = {
|
||||
site: urls for site, urls in sites.items()
|
||||
site: urls for site, urls in sites.items()
|
||||
if urls["https"] or urls["http"]
|
||||
}
|
||||
if not valid_sites:
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
# 'choose-mirror' package as a dependency for debian-installer, so when
|
||||
# a new release of the 'debian-installer' also ships the latest mirror
|
||||
# list available on the resulting netinstall (mini.iso) image.
|
||||
# The same way as 'ubiquity' is for for the next Live Desktop ISOs.
|
||||
|
||||
VERSION=10
|
||||
COMPONENT=main
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue