|
|
|
@ -2,22 +2,23 @@ |
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
|
import subprocess |
|
|
|
|
import libcalamares |
|
|
|
|
from pathlib import Path |
|
|
|
|
import shutil |
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reflector_process(): |
|
|
|
|
|
|
|
|
|
BACKUP_MIRROLIST = "cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak" |
|
|
|
|
RESTORE_MIRROLIST = "cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist" |
|
|
|
|
FETCH_MIRRORS = "reflector --verbose --latest 10 --protocol https --download-timeout 25 --sort rate --save etc/pacman.d/mirrorlist" |
|
|
|
|
MIRRORLIST = "/etc/pacman.d/mirrorlist" |
|
|
|
|
MIRRORLIST_BACKUP = "/etc/pacman.d/mirrorlist.bak" |
|
|
|
|
FETCH_MIRRORS = "reflector --verbose --latest 10 --protocol https --download-timeout 25 --sort rate --save /etc/pacman.d/mirrorlist" |
|
|
|
|
|
|
|
|
|
subprocess.call(BACKUP_MIRROLIST.split(' ')) |
|
|
|
|
shutil.copyfile(MIRRORLIST, MIRRORLIST_BACKUP) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
subprocess.call(FETCH_MIRRORS.split(' ')) |
|
|
|
|
except: |
|
|
|
|
subprocess.call(RESTORE_MIRROLIST.split(' ')) |
|
|
|
|
os.remove(MIRRORLIST) |
|
|
|
|
os.rename(MIRRORLIST_BACKUP, MIRRORLIST) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(): |
|
|
|
|