postcfg: only attempt to rank mirrors if hasInternet
clean up imports
This commit is contained in:
parent
021e3b20c6
commit
2b00d28de2
@ -21,12 +21,10 @@
|
|||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
import os
|
from shutil import copy2
|
||||||
import shutil
|
from distutils.dir_util import copy_tree
|
||||||
import distutils.dir_util
|
|
||||||
|
|
||||||
from os.path import join, exists
|
from os.path import join, exists
|
||||||
from libcalamares.utils import target_env_call, check_target_env_call
|
from libcalamares.utils import target_env_call
|
||||||
|
|
||||||
class ConfigController:
|
class ConfigController:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -42,21 +40,21 @@ class ConfigController:
|
|||||||
return self.__keyrings
|
return self.__keyrings
|
||||||
|
|
||||||
def init_keyring(self):
|
def init_keyring(self):
|
||||||
check_target_env_call(["pacman-key", "--init"])
|
target_env_call(["pacman-key", "--init"])
|
||||||
|
|
||||||
def populate_keyring(self):
|
def populate_keyring(self):
|
||||||
check_target_env_call(["pacman-key", "--populate"] + self.keyrings)
|
target_env_call(["pacman-key", "--populate"] + self.keyrings)
|
||||||
|
|
||||||
def terminate(self, proc):
|
def terminate(self, proc):
|
||||||
target_env_call(['killall', '-9', proc])
|
target_env_call(['killall', '-9', proc])
|
||||||
|
|
||||||
def copy_file(self, file):
|
def copy_file(self, file):
|
||||||
if exists("/" + file):
|
if exists("/" + file):
|
||||||
shutil.copy2("/" + file, join(self.root, file))
|
copy2("/" + file, join(self.root, file))
|
||||||
|
|
||||||
def copy_folder(self, source, target):
|
def copy_folder(self, source, target):
|
||||||
if exists("/" + source):
|
if exists("/" + source):
|
||||||
distutils.dir_util.copy_tree("/" + source, join(self.root, target))
|
copy_tree("/" + source, join(self.root, target))
|
||||||
|
|
||||||
def remove_pkg(self, pkg, path):
|
def remove_pkg(self, pkg, path):
|
||||||
if exists(join(self.root, path)):
|
if exists(join(self.root, path)):
|
||||||
@ -71,6 +69,7 @@ class ConfigController:
|
|||||||
|
|
||||||
# Generate mirror list
|
# Generate mirror list
|
||||||
if exists(join(self.root, "usr/bin/pacman-mirrors")):
|
if exists(join(self.root, "usr/bin/pacman-mirrors")):
|
||||||
|
if libcalamares.globalstorage.value("hasInternet"):
|
||||||
target_env_call(["pacman-mirrors", "-g"])
|
target_env_call(["pacman-mirrors", "-g"])
|
||||||
else:
|
else:
|
||||||
self.copy_file('etc/pacman.d/mirrorlist')
|
self.copy_file('etc/pacman.d/mirrorlist')
|
||||||
|
Loading…
Reference in New Issue
Block a user