Install the package `alsa-firmware` if required (#1812)
This commit is contained in:
parent
128db1cdf6
commit
06f35fd289
|
|
@ -86,6 +86,21 @@ class _SysInfo:
|
||||||
def mem_info_by_key(self, key: str) -> int:
|
def mem_info_by_key(self, key: str) -> int:
|
||||||
return self.mem_info[key]
|
return self.mem_info[key]
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def loaded_modules(self) -> 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
|
||||||
|
|
||||||
|
|
||||||
_sys_info = _SysInfo()
|
_sys_info = _SysInfo()
|
||||||
|
|
||||||
|
|
@ -171,20 +186,9 @@ class SysInfo:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _loaded_modules() -> List[str]:
|
def requires_sof_fw() -> bool:
|
||||||
"""
|
return 'snd_sof' in _sys_info.loaded_modules
|
||||||
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
|
@staticmethod
|
||||||
def requires_sof() -> bool:
|
def requires_alsa_fw() -> bool:
|
||||||
return 'snd_sof' in SysInfo._loaded_modules()
|
return 'snd_emu10k1' in _sys_info.loaded_modules
|
||||||
|
|
|
||||||
|
|
@ -183,8 +183,11 @@ def perform_installation(mountpoint: Path):
|
||||||
elif audio == 'pulseaudio':
|
elif audio == 'pulseaudio':
|
||||||
installation.add_additional_packages("pulseaudio")
|
installation.add_additional_packages("pulseaudio")
|
||||||
|
|
||||||
if SysInfo.requires_sof():
|
if SysInfo.requires_sof_fw():
|
||||||
installation.add_additional_packages('sof-firmware')
|
installation.add_additional_packages('sof-firmware')
|
||||||
|
|
||||||
|
if SysInfo.requires_alsa_fw():
|
||||||
|
installation.add_additional_packages('alsa-firmware')
|
||||||
else:
|
else:
|
||||||
info("No audio server will be installed")
|
info("No audio server will be installed")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,8 +162,11 @@ def perform_installation(mountpoint: Path):
|
||||||
elif audio == 'pulseaudio':
|
elif audio == 'pulseaudio':
|
||||||
installation.add_additional_packages("pulseaudio")
|
installation.add_additional_packages("pulseaudio")
|
||||||
|
|
||||||
if SysInfo.requires_sof():
|
if SysInfo.requires_sof_fw():
|
||||||
installation.add_additional_packages('sof-firmware')
|
installation.add_additional_packages('sof-firmware')
|
||||||
|
|
||||||
|
if SysInfo.requires_alsa_fw():
|
||||||
|
installation.add_additional_packages('alsa-firmware')
|
||||||
else:
|
else:
|
||||||
info("No audio server will be installed.")
|
info("No audio server will be installed.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue