[displaymanager] Also look for Wayland sessions
- Sessions can be X11-sessions (living in xsessions) or Wayland- (living in wayland-sessions). Look in both places. - Refactor code a little to make it nicer to read.
This commit is contained in:
parent
f8ed7009f1
commit
57bb9c16f4
@ -51,15 +51,20 @@ class DesktopEnvironment:
|
||||
self.executable = exec
|
||||
self.desktop_file = desktop
|
||||
|
||||
def find_de_executable(self, root_mount_point):
|
||||
return os.path.exists("{!s}{!s}".format(root_mount_point, self.executable))
|
||||
|
||||
def find_de_session(self, root_mount_point):
|
||||
x11_sessions = "{!s}/usr/share/xsessions/{!s}.desktop".format(root_mount_point, self.desktop_file)
|
||||
wayland_sessions = "{!s}/usr/share/wayland-sessions/{!s}.desktop".format(root_mount_point, self.desktop_file)
|
||||
return os.path.exists(x11_sessions) or os.path.exists(wayland_sessions)
|
||||
|
||||
def find_desktop_environment(self, root_mount_point):
|
||||
"""
|
||||
Check if this environment is installed in the
|
||||
target system at @p root_mount_point.
|
||||
"""
|
||||
return (
|
||||
os.path.exists("{!s}{!s}".format(root_mount_point, self.executable)) and
|
||||
os.path.exists("{!s}/usr/share/xsessions/{!s}.desktop".format(root_mount_point, self.desktop_file))
|
||||
)
|
||||
return find_de_executable(root_mount_point) and find_de_session(root_mount_point)
|
||||
|
||||
|
||||
desktop_environments = [
|
||||
|
Loading…
Reference in New Issue
Block a user