Install the package `sof-firmware` if required (#1811)
This commit is contained in:
parent
89cefb9a1c
commit
128db1cdf6
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict, List
|
||||||
|
|
||||||
from .general import SysCommand
|
from .general import SysCommand
|
||||||
from .networking import list_interfaces, enrich_iface_types
|
from .networking import list_interfaces, enrich_iface_types
|
||||||
|
|
@ -169,3 +169,22 @@ class SysInfo:
|
||||||
debug(f"System is not running in a VM: {err}")
|
debug(f"System is not running in a VM: {err}")
|
||||||
|
|
||||||
return False
|
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()
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,9 @@ def perform_installation(mountpoint: Path):
|
||||||
PipewireProfile().install(installation)
|
PipewireProfile().install(installation)
|
||||||
elif audio == 'pulseaudio':
|
elif audio == 'pulseaudio':
|
||||||
installation.add_additional_packages("pulseaudio")
|
installation.add_additional_packages("pulseaudio")
|
||||||
|
|
||||||
|
if SysInfo.requires_sof():
|
||||||
|
installation.add_additional_packages('sof-firmware')
|
||||||
else:
|
else:
|
||||||
info("No audio server will be installed")
|
info("No audio server will be installed")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,9 @@ def perform_installation(mountpoint: Path):
|
||||||
PipewireProfile().install(installation)
|
PipewireProfile().install(installation)
|
||||||
elif audio == 'pulseaudio':
|
elif audio == 'pulseaudio':
|
||||||
installation.add_additional_packages("pulseaudio")
|
installation.add_additional_packages("pulseaudio")
|
||||||
|
|
||||||
|
if SysInfo.requires_sof():
|
||||||
|
installation.add_additional_packages('sof-firmware')
|
||||||
else:
|
else:
|
||||||
info("No audio server will be installed.")
|
info("No audio server will be installed.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue