[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, Kevin Kofler <kevin.kofler@chello.at>
# 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
# 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,
# but we just do a simple text replacement for now, as it
# worksforme(tm)
lightdm_conf_path = os.path.join(
root_mount_point, "etc/lightdm/lightdm.conf"
)
text = []
if os.path.exists(lightdm_conf_path):
@ -407,6 +405,11 @@ def run():
# setup lightdm
if "lightdm" in displaymanagers:
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:
libcalamares.utils.target_env_call(
['mkdir', '-p', '/run/lightdm']
@ -443,22 +446,30 @@ def run():
if default_desktop_environment is not None:
os.system(
"sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" "
"{!s}/etc/lightdm/lightdm.conf".format(
"sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" " "{!s}".format(
default_desktop_environment.desktop_file,
root_mount_point
lightdm_conf_path
)
)
if default_desktop_environment.desktop_file == "deepin":
os.system(
"sed -i -e \"s/^.greeter-session=.*"
"/greeter-session=lightdm-deepin-greeter/\" "
"{!s}/etc/lightdm/lightdm.conf".format(
root_mount_point
)
)
# configure lightdm-greeter
greeter_path = os.path.join(
root_mount_point, "usr/share/xgreeters"
)
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:
libcalamares.utils.debug("lightdm selected but not installed")
displaymanagers.remove("lightdm")