Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk.py7
-rw-r--r--archinstall/lib/installer.py12
-rw-r--r--examples/guided.py8
3 files changed, 20 insertions, 7 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index fbc11ca3..8e9e0234 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -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:
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index d161c3b7..492d7715 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -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}")
diff --git a/examples/guided.py b/examples/guided.py
index 71e1e01d..f374a41c 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -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'))