@ -96,25 +96,25 @@ class DisplayManager(metaclass=abc.ABCMeta):
def __init__ ( self , root_mount_point ) :
def __init__ ( self , root_mount_point ) :
self . root_mount_point = root_mount_point
self . root_mount_point = root_mount_point
def have_dm ( cls ) :
def have_dm ( self ) :
if cls . executable is None :
"""
Is this DM installed in the target system ?
The default implementation checks for ` executable `
in the target system .
"""
if self . executable is None :
return True
return True
bin_path = " {!s} /usr/bin/ {!s} " . format ( self . root_mount_point , cls . executable )
bin_path = " {!s} /usr/bin/ {!s} " . format ( self . root_mount_point , self . executable )
sbin_path = " {!s} /usr/sbin/ {!s} " . format ( self . root_mount_point , cls . executable )
sbin_path = " {!s} /usr/sbin/ {!s} " . format ( self . root_mount_point , self . executable )
return (
return (
os . path . exists ( bin_path )
os . path . exists ( bin_path )
or os . path . exists ( sbin_path )
or os . path . exists ( sbin_path )
)
)
@abc.abstractmethod
# The four abstract methods below are called in the order listed here.
def set_autologin ( self , username , do_autologin , default_desktop_environment ) :
# They must all be implemented by subclasses, but not all of them
"""
# actually do something for all DMs.
Configure the DM inside the given @p root_mount_point with
autologin ( if @p do_autologin is True ) for the given @p username .
If the DM supports it , set the default DE to @p default_desktop_environment
as well .
"""
@abc.abstractmethod
@abc.abstractmethod
def basic_setup ( self ) :
def basic_setup ( self ) :
@ -138,6 +138,15 @@ class DisplayManager(metaclass=abc.ABCMeta):
"""
"""
# Most implementations do nothing
# Most implementations do nothing
@abc.abstractmethod
def set_autologin ( self , username , do_autologin , default_desktop_environment ) :
"""
Configure the DM inside the given @p root_mount_point with
autologin ( if @p do_autologin is True ) for the given @p username .
If the DM supports it , set the default DE to @p default_desktop_environment
as well .
"""
class DMmdm ( DisplayManager ) :
class DMmdm ( DisplayManager ) :
name = " mdm "
name = " mdm "
@ -221,6 +230,9 @@ class DMmdm(DisplayManager):
)
)
)
)
def greeter_setup ( self ) :
pass
class DMgdm ( DisplayManager ) :
class DMgdm ( DisplayManager ) :
name = " gdm "
name = " gdm "
@ -305,6 +317,12 @@ class DMgdm(DisplayManager):
[ ' chown ' , ' -R ' , ' gdm:gdm ' , ' /var/lib/gdm ' ]
[ ' chown ' , ' -R ' , ' gdm:gdm ' , ' /var/lib/gdm ' ]
)
)
def desktop_environment_setup ( self , desktop_environment ) :
pass
def greeter_setup ( self ) :
pass
class DMkdm ( DisplayManager ) :
class DMkdm ( DisplayManager ) :
name = " kdm "
name = " kdm "
@ -377,6 +395,12 @@ class DMkdm(DisplayManager):
[ ' chown ' , ' -R ' , ' 135:135 ' , ' var/lib/kdm ' ]
[ ' chown ' , ' -R ' , ' 135:135 ' , ' var/lib/kdm ' ]
)
)
def desktop_environment_setup ( self , desktop_environment ) :
pass
def greeter_setup ( self ) :
pass
class DMlxdm ( DisplayManager ) :
class DMlxdm ( DisplayManager ) :
name = " lxdm "
name = " lxdm "
@ -433,6 +457,9 @@ class DMlxdm(DisplayManager):
)
)
)
)
def greeter_setup ( self ) :
pass
class DMlightdm ( DisplayManager ) :
class DMlightdm ( DisplayManager ) :
name = " lightdm "
name = " lightdm "
@ -592,6 +619,12 @@ class DMslim(DisplayManager):
def basic_setup ( self ) :
def basic_setup ( self ) :
pass
pass
def desktop_environment_setup ( self , desktop_environment ) :
pass
def greeter_setup ( self ) :
pass
class DMsddm ( DisplayManager ) :
class DMsddm ( DisplayManager ) :
name = " sddm "
name = " sddm "
@ -630,6 +663,12 @@ class DMsddm(DisplayManager):
def basic_setup ( self ) :
def basic_setup ( self ) :
pass
pass
def desktop_environment_setup ( self , desktop_environment ) :
pass
def greeter_setup ( self ) :
pass
class DMsysconfig ( DisplayManager ) :
class DMsysconfig ( DisplayManager ) :
name = " sysconfig "
name = " sysconfig "
@ -651,6 +690,12 @@ class DMsysconfig(DisplayManager):
def basic_setup ( self ) :
def basic_setup ( self ) :
pass
pass
def desktop_environment_setup ( self , desktop_environment ) :
pass
def greeter_setup ( self ) :
pass
# Collect all the subclasses of DisplayManager defined above,
# Collect all the subclasses of DisplayManager defined above,
# and index them based on the name property of each class.
# and index them based on the name property of each class.