Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-05-12 02:24:14 -0400
committerGitHub <noreply@github.com>2023-05-12 08:24:14 +0200
commit128db1cdf6698aba09915bb7c044404f713755ef (patch)
tree3d224e5b5aa7eae96c94866ba6ae186efb75d1a6
parent89cefb9a1c7d4c4968e7d8645149078e601c9d1c (diff)
Install the package `sof-firmware` if required (#1811)
-rw-r--r--archinstall/lib/hardware.py21
-rw-r--r--archinstall/scripts/guided.py3
-rw-r--r--examples/interactive_installation.py3
3 files changed, 26 insertions, 1 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index b95301f9..8d0fb74f 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -1,7 +1,7 @@
import os
from functools import cached_property
from pathlib import Path
-from typing import Optional, Dict
+from typing import Optional, Dict, List
from .general import SysCommand
from .networking import list_interfaces, enrich_iface_types
@@ -169,3 +169,22 @@ class SysInfo:
debug(f"System is not running in a VM: {err}")
return False
+
+ @staticmethod
+ def _loaded_modules() -> List[str]:
+ """
+ Returns loaded kernel modules
+ """
+ modules_path = Path('/proc/modules')
+ modules: List[str] = []
+
+ with modules_path.open() as file:
+ for line in file:
+ module = line.split(maxsplit=1)[0]
+ modules.append(module)
+
+ return modules
+
+ @staticmethod
+ def requires_sof() -> bool:
+ return 'snd_sof' in SysInfo._loaded_modules()
diff --git a/archinstall/scripts/guided.py b/archinstall/scripts/guided.py
index 37cc1cad..9cb4ec2a 100644
--- a/archinstall/scripts/guided.py
+++ b/archinstall/scripts/guided.py
@@ -182,6 +182,9 @@ def perform_installation(mountpoint: Path):
PipewireProfile().install(installation)
elif audio == 'pulseaudio':
installation.add_additional_packages("pulseaudio")
+
+ if SysInfo.requires_sof():
+ installation.add_additional_packages('sof-firmware')
else:
info("No audio server will be installed")
diff --git a/examples/interactive_installation.py b/examples/interactive_installation.py
index 72595048..5738a9cc 100644
--- a/examples/interactive_installation.py
+++ b/examples/interactive_installation.py
@@ -161,6 +161,9 @@ def perform_installation(mountpoint: Path):
PipewireProfile().install(installation)
elif audio == 'pulseaudio':
installation.add_additional_packages("pulseaudio")
+
+ if SysInfo.requires_sof():
+ installation.add_additional_packages('sof-firmware')
else:
info("No audio server will be installed.")