Merge pull request #2 from archlinux/torxed-v2.2.0

Torxed v2.2.0
This commit is contained in:
m1ten 2021-04-04 12:46:31 -04:00 committed by GitHub
commit 5018bef41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 8 deletions

6
.github/CODEOWNERS vendored
View File

@ -1,3 +1,7 @@
# As per https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#example-of-a-codeowners-file
* @Torxed @grazzolini
* @Torxed
# Any PKGBUILD changes should tag grazzolini
/PKGBUILDs/ @grazzolini
/PKGBUILD @grazzolini

View File

@ -198,9 +198,9 @@ class Partition():
This is more reliable than relying on /dev/disk/by-partuuid as
it doesn't seam to be able to detect md raid partitions.
"""
lsblk = b''.join(sys_command(f'lsblk -J {self.path}'))
lsblk = b''.join(sys_command(f'lsblk -J -o+PARTUUID {self.path}'))
for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
return partition['partuuid']
return partition.get('partuuid', None)
@property
def encrypted(self):

View File

@ -76,7 +76,7 @@ class sys_command():#Thread):
"""
Stolen from archinstall_gui
"""
def __init__(self, cmd, callback=None, start_callback=None, *args, **kwargs):
def __init__(self, cmd, callback=None, start_callback=None, peak_output=False, *args, **kwargs):
kwargs.setdefault("worker_id", gen_uid())
kwargs.setdefault("emulate", False)
kwargs.setdefault("suppress_errors", False)
@ -101,6 +101,7 @@ class sys_command():#Thread):
self.args = args
self.kwargs = kwargs
self.peak_output = peak_output
self.kwargs.setdefault("worker", None)
self.callback = callback
@ -158,6 +159,38 @@ class sys_command():#Thread):
'exit_code': self.exit_code
}
def peak(self, output :str):
if type(output) == bytes:
try:
output = output.decode('UTF-8')
except UnicodeDecodeError:
return None
output = output.strip('\r\n ')
if len(output) <= 0:
return None
if self.peak_output:
from .user_interaction import get_terminal_width
# Move back to the beginning of the terminal
sys.stdout.flush()
sys.stdout.write("\033[%dG" % 0)
sys.stdout.flush()
# Clear the line
sys.stdout.write(" " * get_terminal_width())
sys.stdout.flush()
# Move back to the beginning again
sys.stdout.flush()
sys.stdout.write("\033[%dG" % 0)
sys.stdout.flush()
# And print the new output we're peaking on:
sys.stdout.write(output)
sys.stdout.flush()
def run(self):
self.status = 'running'
old_dir = os.getcwd()
@ -189,6 +222,7 @@ class sys_command():#Thread):
for fileno, event in poller.poll(0.1):
try:
output = os.read(child_fd, 8192)
self.peak(output)
self.trace_log += output
except OSError:
alive = False

View File

@ -137,7 +137,7 @@ class Installer():
self.log(f'Installing packages: {packages}', level=LOG_LEVELS.Info)
if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0:
if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.mountpoint} {" ".join(packages)}', **kwargs)).exit_code == 0:
if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.mountpoint} {" ".join(packages)}', peak_output=True, **kwargs)).exit_code == 0:
return True
else:
self.log(f'Could not strap in packages: {pacstrap.exit_code}', level=LOG_LEVELS.Info)

View File

@ -94,10 +94,12 @@ def ask_to_configure_network():
# Optionally configure one network interface.
#while 1:
# {MAC: Ifname}
interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation', **list_interfaces()}
interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage your internet connection', **list_interfaces()}
nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ")
if nic and nic != 'Copy ISO network configuration to installation':
if nic == 'Use NetworkManager to control and manage your internet connection':
return {'nic': nic,'NetworkManager':True}
mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ")
if mode == 'IP (static)':
while 1:

View File

@ -320,7 +320,9 @@ def perform_installation(device, boot_partition, language, mirrors):
# Perform a copy of the config
if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation':
installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium.
elif archinstall.arguments.get('nic',{}).get('NetworkManager',False):
installation.add_additional_packages("networkmanager")
installation.enable_service('NetworkManager.service')
# Otherwise, if a interface was selected, configure that interface
elif archinstall.arguments.get('nic', None):
installation.configure_nic(**archinstall.arguments.get('nic', {}))
@ -348,4 +350,4 @@ def perform_installation(device, boot_partition, language, mirrors):
ask_user_questions()
perform_installation_steps()
perform_installation_steps()