Skip to content

Commit

Permalink
fix(lightdm): install raspberrypi-ui-mods instead of lightdm to activ…
Browse files Browse the repository at this point in the history
…ate wayland and enable rpi-connect screen sharing
  • Loading branch information
sassanh committed Sep 1, 2024
1 parent 0e7ad6f commit 1583375
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- fix(lightdm): update the menu when installation is done
- refactor(lightdm): reorder settings menu and replace "utilities" with "desktop"
- feat(lightdm): show a notification when rpi-connect is started to inform user desktop should be installed for the screen sharing to work
- fix(lightdm): install raspberrypi-ui-mods instead of lightdm to activate wayland and enable rpi-connect screen sharing

## Version 0.15.11

Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/050-lightdm/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async def check_lightdm() -> None:
is_active, is_enabled, is_installed = await asyncio.gather(
is_unit_active('lightdm'),
is_unit_enabled('lightdm'),
is_package_installed('lightdm'),
is_package_installed('raspberrypi-ui-mods'),
)

dispatch(
Expand Down
38 changes: 31 additions & 7 deletions ubo_app/system/system_manager/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,47 @@

from __future__ import annotations

import subprocess

from ubo_app.logging import get_logger
from ubo_app.utils.apt import install_package, uninstall_package

PACKAGE_WHITELIST = [
'lightdm',
'rpi-connect',
]

logger = get_logger('system-manager')


def package_handler(action: str, package: str) -> str:
"""Handle package actions."""
if package not in PACKAGE_WHITELIST:
return 'Package not in whitelist'

if action == 'install':
install_package(package)
return 'installed'
if action == 'uninstall':
uninstall_package(package)
return 'uninstalled'
return 'Invalid package action'
try:
if action == 'install':
if package == 'lightdm':
install_package('raspberrypi-ui-mods', force=True)
subprocess.run( # noqa: S603
[
'/usr/bin/env',
'sed',
'-i',
'/etc/lightdm/lightdm.conf',
'-e',
's|#\\?autologin-user=.*|autologin-user=ubo|',
],
check=False,
)
else:
install_package(package)
return 'installed'
if action == 'uninstall':
uninstall_package(package)
return 'uninstalled'
except Exception:
logger.exception('Failed to handle package action')
return 'error'
else:
return 'Invalid package action'

0 comments on commit 1583375

Please sign in to comment.