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/installer.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 94bdff7d..ba57a001 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -859,19 +859,20 @@ class Installer:
):
self.pacman.strap('grub') # no need?
- _file = "/etc/default/grub"
+ grub_default = self.target / 'etc/default/grub'
+ config = grub_default.read_text()
+
+ cmdline_linux = []
if root_partition in self._disk_encryption.partitions:
debug(f"Using UUID {root_partition.uuid} as encrypted root identifier")
- cmd_line_linux = f"sed -i 's/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=UUID={root_partition.uuid}:cryptlvm rootfstype={root_partition.safe_fs_type.value}\"/'"
- enable_cryptdisk = "sed -i 's/#GRUB_ENABLE_CRYPTODISK=y/GRUB_ENABLE_CRYPTODISK=y/'"
-
- SysCommand(f"/usr/bin/arch-chroot {self.target} {enable_cryptdisk} {_file}")
- else:
- cmd_line_linux = f"sed -i 's/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"rootfstype={root_partition.safe_fs_type.value}\"/'"
+ cmdline_linux.append(f'cryptdevice=UUID={root_partition.uuid}:cryptlvm')
+ config = re.sub(r'#(GRUB_ENABLE_CRYPTODISK=y\n)', r'\1', config, 1)
- SysCommand(f"/usr/bin/arch-chroot {self.target} {cmd_line_linux} {_file}")
+ cmdline_linux.append(f'rootfstype={root_partition.safe_fs_type.value}')
+ config = re.sub(r'(GRUB_CMDLINE_LINUX=")("\n)', rf'\1{" ".join(cmdline_linux)}\2', config, 1)
+ grub_default.write_text(config)
info(f"GRUB boot partition: {boot_partition.dev_path}")