temp commit
Copies changes to /usr/share/ubuntu-drivers-common/fake-devices-wrapper to /target/usr/share/ubuntu-drivers-common/fake-devices-wrapper. Makes sure the command is called in the system environment and not the snap environment. in-progress umockdev configs misc logging statements
This commit is contained in:
parent
410b7326fa
commit
e57404953c
|
@ -0,0 +1 @@
|
||||||
|
ubuntu_drivers_run_on_host_umockdev: "examples/umockdev/broadcom.yaml"
|
|
@ -0,0 +1,7 @@
|
||||||
|
devices:
|
||||||
|
# This is a fake broadcom wireless chip
|
||||||
|
- modalias: 'pci:v000014E4d00004353sv00sd01bc02sc80i00'
|
||||||
|
vendor: '0x14E4'
|
||||||
|
device: '0x4353'
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,14 @@ class DriversController(SubiquityController):
|
||||||
|
|
||||||
@with_context()
|
@with_context()
|
||||||
async def _list_drivers(self, context):
|
async def _list_drivers(self, context):
|
||||||
|
log.debug("about to wait_apt")
|
||||||
with context.child("wait_apt"):
|
with context.child("wait_apt"):
|
||||||
await self._wait_apt.wait()
|
await self._wait_apt.wait()
|
||||||
# The APT_CONFIGURED event (which unblocks _wait_apt.wait) is sent
|
# The APT_CONFIGURED event (which unblocks _wait_apt.wait) is sent
|
||||||
# after the user confirms the destruction changes. At this point, the
|
# after the user confirms the destruction changes. At this point, the
|
||||||
# source is already mounted so the user can't go back all the way to
|
# source is already mounted so the user can't go back all the way to
|
||||||
# the source screen to enable/disable the "search drivers" checkbox.
|
# the source screen to enable/disable the "search drivers" checkbox.
|
||||||
|
log.debug("about to check if search_drivers")
|
||||||
if not self.app.controllers.Source.model.search_drivers:
|
if not self.app.controllers.Source.model.search_drivers:
|
||||||
self.drivers = []
|
self.drivers = []
|
||||||
self.list_drivers_done_event.set()
|
self.list_drivers_done_event.set()
|
||||||
|
@ -104,12 +106,15 @@ class DriversController(SubiquityController):
|
||||||
apt = self.app.controllers.Mirror.final_apt_configurer
|
apt = self.app.controllers.Mirror.final_apt_configurer
|
||||||
try:
|
try:
|
||||||
async with apt.overlay() as d:
|
async with apt.overlay() as d:
|
||||||
|
log.debug("about to ensure_cmd_exists")
|
||||||
try:
|
try:
|
||||||
# Make sure ubuntu-drivers is available.
|
# Make sure ubuntu-drivers is available.
|
||||||
await self.ubuntu_drivers.ensure_cmd_exists(d.mountpoint)
|
await self.ubuntu_drivers.ensure_cmd_exists(d.mountpoint)
|
||||||
except CommandNotFoundError:
|
except CommandNotFoundError:
|
||||||
|
log.debug("cmd dne")
|
||||||
self.drivers = []
|
self.drivers = []
|
||||||
else:
|
else:
|
||||||
|
log.debug("cmd exists")
|
||||||
self.drivers = await self.ubuntu_drivers.list_drivers(
|
self.drivers = await self.ubuntu_drivers.list_drivers(
|
||||||
root_dir=d.mountpoint, context=context
|
root_dir=d.mountpoint, context=context
|
||||||
)
|
)
|
||||||
|
|
|
@ -177,7 +177,11 @@ class UbuntuDriversFakePCIDevicesInterface(UbuntuDriversInterface):
|
||||||
|
|
||||||
app.base_model.drivers.fake_pci_devices = True
|
app.base_model.drivers.fake_pci_devices = True
|
||||||
|
|
||||||
prefix: list[str] = ["/usr/share/ubuntu-drivers-common/fake-devices-wrapper"]
|
prefix: list[str] = [
|
||||||
|
"env",
|
||||||
|
"-i",
|
||||||
|
"/usr/share/ubuntu-drivers-common/fake-devices-wrapper",
|
||||||
|
]
|
||||||
self.list_drivers_cmd = prefix + self.list_drivers_cmd
|
self.list_drivers_cmd = prefix + self.list_drivers_cmd
|
||||||
self.list_oem_cmd = prefix + self.list_oem_cmd
|
self.list_oem_cmd = prefix + self.list_oem_cmd
|
||||||
self.install_drivers_cmd = prefix + self.install_drivers_cmd
|
self.install_drivers_cmd = prefix + self.install_drivers_cmd
|
||||||
|
@ -185,6 +189,7 @@ class UbuntuDriversFakePCIDevicesInterface(UbuntuDriversInterface):
|
||||||
async def ensure_cmd_exists(self, root_dir: str) -> None:
|
async def ensure_cmd_exists(self, root_dir: str) -> None:
|
||||||
# TODO This does not tell us if the "--recommended" option is
|
# TODO This does not tell us if the "--recommended" option is
|
||||||
# available.
|
# available.
|
||||||
|
log.debug("in fake ensure")
|
||||||
try:
|
try:
|
||||||
await arun_command(["sh", "-c", "command -v ubuntu-drivers"], check=True)
|
await arun_command(["sh", "-c", "command -v ubuntu-drivers"], check=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
@ -193,7 +198,11 @@ class UbuntuDriversFakePCIDevicesInterface(UbuntuDriversInterface):
|
||||||
)
|
)
|
||||||
|
|
||||||
async def list_drivers(self, root_dir: str, context) -> List[str]:
|
async def list_drivers(self, root_dir: str, context) -> List[str]:
|
||||||
|
log.debug("in fake list")
|
||||||
result = await arun_command(self.list_drivers_cmd)
|
result = await arun_command(self.list_drivers_cmd)
|
||||||
|
log.debug("got fake list")
|
||||||
|
log.debug(f"fake list={result.stdout}")
|
||||||
|
log.debug(f"result stderr={result.stderr}")
|
||||||
return self._drivers_from_output(result.stdout)
|
return self._drivers_from_output(result.stdout)
|
||||||
|
|
||||||
async def list_oem(self, root_dir: str, context) -> List[str]:
|
async def list_oem(self, root_dir: str, context) -> List[str]:
|
||||||
|
@ -201,6 +210,26 @@ class UbuntuDriversFakePCIDevicesInterface(UbuntuDriversInterface):
|
||||||
result = await arun_command(self.list_oem_cmd)
|
result = await arun_command(self.list_oem_cmd)
|
||||||
return self._oem_metapackages_from_output(result.stdout)
|
return self._oem_metapackages_from_output(result.stdout)
|
||||||
|
|
||||||
|
async def install_drivers(self, root_dir: str, context) -> None:
|
||||||
|
await arun_command(
|
||||||
|
[
|
||||||
|
"cp",
|
||||||
|
"/usr/share/ubuntu-drivers-common/fake-devices-wrapper",
|
||||||
|
f"{root_dir}/usr/share/ubuntu-drivers-common/fake-devices-wrapper",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
await run_curtin_command(
|
||||||
|
self.app,
|
||||||
|
context,
|
||||||
|
"in-target",
|
||||||
|
"-t",
|
||||||
|
root_dir,
|
||||||
|
"--",
|
||||||
|
*self.install_drivers_cmd,
|
||||||
|
private_mounts=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class UbuntuDriversHasDriversInterface(UbuntuDriversInterface):
|
class UbuntuDriversHasDriversInterface(UbuntuDriversInterface):
|
||||||
"""A dry-run implementation of ubuntu-drivers that returns a hard-coded
|
"""A dry-run implementation of ubuntu-drivers that returns a hard-coded
|
||||||
|
|
Loading…
Reference in New Issue