diff --git a/archinstoo/archinstoo/lib/disk/device_handler.py b/archinstoo/archinstoo/lib/disk/device_handler.py index ca2ccba3..293b3377 100644 --- a/archinstoo/archinstoo/lib/disk/device_handler.py +++ b/archinstoo/archinstoo/lib/disk/device_handler.py @@ -542,7 +542,7 @@ def _setup_partition( if disk.type == PartitionTable.GPT.value: if part_mod.is_root(): - partition.type_uuid = PartitionGUID.LINUX_ROOT_X86_64.bytes + partition.type_uuid = PartitionGUID.linux_root().bytes elif PartitionFlag.LINUX_HOME not in part_mod.flags and part_mod.is_home(): partition.setFlag(PartitionFlag.LINUX_HOME.flag_id) diff --git a/archinstoo/archinstoo/lib/installer.py b/archinstoo/archinstoo/lib/installer.py index aa651d3d..210efd75 100644 --- a/archinstoo/archinstoo/lib/installer.py +++ b/archinstoo/archinstoo/lib/installer.py @@ -2552,18 +2552,16 @@ def run_grimoire_installation( def run_custom_user_commands(commands: list[str], installation: Installer) -> None: for index, command in enumerate(commands): - script_path = f'/var/tmp/user-command.{index}.sh' # noqa: S108 - path inside install target, not host /tmp - chroot_path = f'{installation.target}/{script_path}' + script_path = LPath(f'/var/tmp/user-command.{index}.sh') # noqa: S108 - path inside install target, not host /tmp + chroot_path = installation.target / script_path.relative_to_root() # Do not throw error instead warn info(f'Executing custom command "{command}" ...') - chroot_path_p = Path(chroot_path) - with chroot_path_p.open('w') as user_script: - user_script.write(command) + chroot_path.write_text(command) try: SysCommand(f'{" ".join(installation._arch_chroot_prefix)} bash {script_path}') except SysCallError as e: warn(f'Custom command "{command}" failed: {e}') finally: - chroot_path_p.unlink() + chroot_path.unlink() diff --git a/archinstoo/archinstoo/lib/models/device.py b/archinstoo/archinstoo/lib/models/device.py index ed811115..66150afa 100644 --- a/archinstoo/archinstoo/lib/models/device.py +++ b/archinstoo/archinstoo/lib/models/device.py @@ -835,8 +835,17 @@ def from_string(cls, s: str) -> Self | None: class PartitionGUID(Enum): # A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs + LINUX_ROOT_AARCH64 = 'B921B045-1DF0-41C3-AF44-4C6F280D3FAE' LINUX_ROOT_X86_64 = '4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709' + @classmethod + def linux_root(cls) -> Self: + # discoverable partitions spec keys root by arch: the wrong GUID + # leaves systemd-gpt-auto-generator unable to find / + if SysInfo.arch() == 'aarch64': + return cls.LINUX_ROOT_AARCH64 + return cls.LINUX_ROOT_X86_64 + @property def bytes(self) -> builtins.bytes: return uuid.UUID(self.value).bytes