From 7f7ab50356d7c877cdf97cb6c011a5288be9131f Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Wed, 28 Jun 2017 02:47:21 +0200 Subject: [PATCH] [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 --- src/modules/displaymanager/main.py | 39 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 785ba29e2..be8e171c1 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -7,6 +7,7 @@ # Copyright 2014-2015, Teo Mrnjavac # Copyright 2014, Kevin Kofler # Copyright 2017, Alf Gaida +# Copyright 2017, Bernhard Landauer # # 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")