Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archinstoo/archinstoo/lib/disk/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 4 additions & 6 deletions archinstoo/archinstoo/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
9 changes: 9 additions & 0 deletions archinstoo/archinstoo/lib/models/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading