fixed some issues with the changes

This commit is contained in:
advaithm 2021-04-02 10:08:16 +05:30
parent f4e616cd9e
commit b974b93004
No known key found for this signature in database
GPG Key ID: E557E45E6DAFFC0C
3 changed files with 20 additions and 7 deletions

View File

@ -390,12 +390,9 @@ class Filesystem():
# TODO:
# When instance of a HDD is selected, check all usages and gracefully unmount them
# as well as close any crypto handles.
def __init__(self, blockdevice):
def __init__(self, blockdevice,mode):
self.blockdevice = blockdevice
if hasUEFI():
self.mode = GPT
else:
self.mode = MBR
self.mode = mode
def __enter__(self, *args, **kwargs):
if self.blockdevice.keep_partitions is False:

View File

@ -1,4 +1,4 @@
import os, stat, time, shutil, pathlib
import os, stat, time, shutil, pathlib, subprocess
from .exceptions import *
from .disk import *
@ -398,6 +398,16 @@ class Installer():
break
raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.")
elif bootloader == "grub-install":
if hasUEFI():
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
else:
root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path.strip("/dev/")}/..")',shell=True).decode().strip()
if root_device == "block":
root_device = f"{self.partition.path}"
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc /dev/{root_device}'))
sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
else:
raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}")

View File

@ -1,5 +1,6 @@
import getpass, time, json, sys, signal, os
import archinstall
from archinstall.lib.hardware import hasUEFI
"""
This signal-handler chain (and global variable)
@ -244,7 +245,12 @@ def perform_installation_steps():
Setup the blockdevice, filesystem (and optionally encryption).
Once that's done, we'll hand over to perform_installation()
"""
with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
# maybe we can ask the user what they would prefer on uefi systems?
if hasUEFI():
mode = archinstall.GPT
else:
mode = archinstall.MBR
with archinstall.Filesystem(archinstall.arguments['harddrive'],mode) as fs:
# Wipe the entire drive if the disk flag `keep_partitions`is False.
if archinstall.arguments['harddrive'].keep_partitions is False:
fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'))