[displaymanager] check for installed lightdm greeter and configure accordingly

- no matter if for example slick-greeter is installed as "lightdm-slick-greeter" or whatever.
  tested with lightdm-deepin-greeter and slick-greeter.
- plus some little simplifications
- added Copyright
https://github.com/calamares/calamares/issues/756
This commit is contained in:
Bernhard Landauer 2017-06-28 02:47:21 +02:00
parent d4e8e4f472
commit 7f7ab50356

View File

@ -7,6 +7,7 @@
# Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> # Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at> # Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
# Copyright 2017, Alf Gaida <agaida@siduction.org> # Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2017, Bernhard Landauer <oberon@manjaro.org>
# #
# Calamares is free software: you can redistribute it and/or modify # Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -265,9 +266,6 @@ def set_autologin(username,
# Ideally, we should use configparser for the ini conf file, # Ideally, we should use configparser for the ini conf file,
# but we just do a simple text replacement for now, as it # but we just do a simple text replacement for now, as it
# worksforme(tm) # worksforme(tm)
lightdm_conf_path = os.path.join(
root_mount_point, "etc/lightdm/lightdm.conf"
)
text = [] text = []
if os.path.exists(lightdm_conf_path): if os.path.exists(lightdm_conf_path):
@ -407,6 +405,11 @@ def run():
# setup lightdm # setup lightdm
if "lightdm" in displaymanagers: if "lightdm" in displaymanagers:
if have_dm("lightdm", root_mount_point): if have_dm("lightdm", root_mount_point):
global lightdm_conf_path
lightdm_conf_path = os.path.join(
root_mount_point, "etc/lightdm/lightdm.conf"
)
if enable_basic_setup: if enable_basic_setup:
libcalamares.utils.target_env_call( libcalamares.utils.target_env_call(
['mkdir', '-p', '/run/lightdm'] ['mkdir', '-p', '/run/lightdm']
@ -443,22 +446,30 @@ def run():
if default_desktop_environment is not None: if default_desktop_environment is not None:
os.system( os.system(
"sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" " "sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" " "{!s}".format(
"{!s}/etc/lightdm/lightdm.conf".format(
default_desktop_environment.desktop_file, default_desktop_environment.desktop_file,
root_mount_point lightdm_conf_path
) )
) )
if default_desktop_environment.desktop_file == "deepin": # configure lightdm-greeter
os.system( greeter_path = os.path.join(
"sed -i -e \"s/^.greeter-session=.*" root_mount_point, "usr/share/xgreeters"
"/greeter-session=lightdm-deepin-greeter/\" "
"{!s}/etc/lightdm/lightdm.conf".format(
root_mount_point
)
) )
if (os.path.exists(greeter_path)):
greeter = os.listdir(greeter_path)[0].split('.')[0]
libcalamares.utils.debug("configure {!s}".format(greeter))
with open(lightdm_conf_path, 'r') as lightdm_conf:
text = lightdm_conf.readlines()
with open(lightdm_conf_path, 'w') as lightdm_conf:
for line in text:
if line.startswith("#greeter-session="):
line = "greeter-session={!s}\n".format(greeter)
lightdm_conf.write(line)
else:
return ("No lightdm greeter installed.")
else: else:
libcalamares.utils.debug("lightdm selected but not installed") libcalamares.utils.debug("lightdm selected but not installed")
displaymanagers.remove("lightdm") displaymanagers.remove("lightdm")