From a525de8f11a875f2784b2cfef1bc652b2089357d Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 29 Nov 2014 16:56:16 +0100 Subject: [PATCH 01/11] displaymanager: Fix typos in displaymanager.conf. --- src/modules/displaymanager/displaymanager.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/displaymanager/displaymanager.conf b/src/modules/displaymanager/displaymanager.conf index 443f5061c..68f3e4eee 100644 --- a/src/modules/displaymanager/displaymanager.conf +++ b/src/modules/displaymanager/displaymanager.conf @@ -11,7 +11,7 @@ displaymanagers: - lxdm - kdm -#Enable followed settings to force a destop environment in your displaymanager configuration file +#Enable the following settings to force a desktop environment in your displaymanager configuration file: #default_desktop_environment: # executable: "startkde" # desktop_file: "plasma" From 2783f98615fa03a2bffa879f10ea261d9a6f9f48 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 29 Nov 2014 16:56:43 +0100 Subject: [PATCH 02/11] displaymanager: Add my copyright to main.py. I have already written a bunch of code in there. --- src/modules/displaymanager/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 1c271c48c..546ec742f 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -4,6 +4,7 @@ # # Copyright 2014, Philip Müller # Copyright 2014, Teo Mrnjavac +# Copyright 2014, Kevin Kofler # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From e78418b6936e6e603f6e3760b72e9308a69ddb8c Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 29 Nov 2014 17:14:17 +0100 Subject: [PATCH 03/11] displaymanager: Don't error if a DM is not installed. If a display manager is in the list, but not installed, do not return an error message, but only print a debugging message and proceed. This allows distributions that support multiple display managers to list them all, independently of what the concrete live image will be using. --- src/modules/displaymanager/main.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 546ec742f..4a1e4858f 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -188,7 +188,7 @@ def run(): # We acquire a list of displaymanagers, either from config or (overridden) from globalstorage. # This module will try to set up (including autologin) all the displaymanagers in the list, in that specific order. # Most distros will probably only ship one displaymanager. - # If a displaymanager is in the list but not installed, this module quits with error. + # If a displaymanager is in the list but not installed, a debugging message is printed and the entry ignored. if "displaymanagers" in libcalamares.job.configuration: displaymanagers = libcalamares.job.configuration["displaymanagers"] @@ -212,12 +212,14 @@ def run(): # Setup slim if "slim" in displaymanagers: if not os.path.exists("%s/usr/bin/slim" % root_mount_point): - return "slim selected but not installed", "" + libcalamares.utils.debug("slim selected but not installed") + displaymanagers.remove("slim") # Setup sddm if "sddm" in displaymanagers: if not os.path.exists("%s/usr/bin/sddm" % root_mount_point): - return "sddm selected but not installed", "" + libcalamares.utils.debug("sddm selected but not installed") + displaymanagers.remove("sddm") # setup lightdm if "lightdm" in displaymanagers: @@ -242,7 +244,8 @@ def run(): libcalamares.utils.chroot_call( ['chmod', '+r' '/etc/lightdm/lightdm.conf']) else: - return "lightdm selected but not installed", "" + libcalamares.utils.debug("lightdm selected but not installed") + displaymanagers.remove("lightdm") # Setup gdm if "gdm" in displaymanagers: @@ -265,7 +268,8 @@ def run(): os.system( "echo \"Icon=\" >> %s/var/lib/AccountsService/users/gdm" % root_mount_point) else: - return "gdm selected but not installed", "" + libcalamares.utils.debug("gdm selected but not installed") + displaymanagers.remove("gdm") # Setup mdm if "mdm" in displaymanagers: @@ -284,7 +288,8 @@ def run(): os.system( "sed -i 's|default.desktop|%s.desktop|g' %s/etc/mdm/custom.conf" % (default_desktop_environment.desktop_file, root_mount_point)) else: - return "mdm selected but not installed", "" + libcalamares.utils.debug("mdm selected but not installed") + displaymanagers.remove("mdm") # Setup lxdm if "lxdm" in displaymanagers: @@ -300,7 +305,8 @@ def run(): libcalamares.utils.chroot_call( ['chmod', '+r', '/etc/lxdm/lxdm.conf']) else: - return "lxdm selected but not installed", "" + libcalamares.utils.debug("lxdm selected but not installed") + displaymanagers.remove("lxdm") # Setup kdm if "kdm" in displaymanagers: @@ -316,7 +322,8 @@ def run(): ['xdg-icon-resource', 'forceupdate', '--theme', 'hicolor']) libcalamares.utils.chroot_call(['update-desktop-database', '-q']) else: - return "kdm selected but not installed", "" + libcalamares.utils.debug("kdm selected but not installed") + displaymanagers.remove("kdm") if username != None: libcalamares.utils.debug( From 5e14080891c6e27219a9b0bbb241d1fcf034ef5a Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 29 Nov 2014 17:21:36 +0100 Subject: [PATCH 04/11] displaymanager: Remove lightdm gdmflexiserver hack. Remove the hack that symlinks /usr/lib/lightdm/lightdm/gdmflexiserver as /usr/bin/gdmflexiserver. Upstream LightDM removed their gdmflexiserver implementation in 1.9.4 in 2013: http://bazaar.launchpad.net/~lightdm-team/lightdm/trunk/revision/1841 In addition, LightDM was already adding the path containing its gdmflexiserver implementation to PATH, so there was no use symlinking it into /usr/bin, potentially overwriting the original version from GDM. This must have been a workaround for an ancient LightDM version that didn't even do that. And finally, the hardcoded /usr/lib/lightdm/lightdm/gdmflexiserver path was wrong on Fedora to begin with (we had used /usr/libexec/lightdm/gdmflexiserver, but now the file is completely gone because upstream removed it). --- src/modules/displaymanager/main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 4a1e4858f..6b90e34a8 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -238,9 +238,6 @@ def run(): if default_desktop_environment != None: os.system( "sed -i -e 's/^.*user-session=.*/user-session=%s/' %s/etc/lightdm/lightdm.conf" % (default_desktop_environment.desktop_file, root_mount_point)) - libcalamares.utils.chroot_call(['ln', '-s', - '/usr/lib/lightdm/lightdm/gdmflexiserver', - '/usr/bin/gdmflexiserver']) libcalamares.utils.chroot_call( ['chmod', '+r' '/etc/lightdm/lightdm.conf']) else: From 524bcc15eacc8425de7d5bd32c19e825cb2cf215 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:01:39 +0100 Subject: [PATCH 05/11] displaymanager: Fix default session setup for GDM. The default session setting in GDM is per user. Therefore, it is not of much use to set it for the gdm user. (Nobody will log in as "gdm".) Unfortunately, there seems to be no systemwide setting for the default session, the AccountsService provides no such setting, and GDM just hardcodes the fallback to use if it is not set in the AccountsService. (GDM first tries "gnome", and if that is not available, it picks the first session in the alphabet.) Therefore, the best we can do right now is to set the default session for the autoLoginUser. This is the case where it matters the most anyway. We would also need the username of a non-autologin user in the global storage to do any better. --- src/modules/displaymanager/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 6b90e34a8..2168662c3 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -89,6 +89,14 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m gdm_conf.write('[daemon]\n') gdm_conf.write('AutomaticLogin=%s\n' % username) gdm_conf.write('AutomaticLoginEnable=True\n') + if os.path.exists("%s/var/lib/AccountsService/users" % root_mount_point): + os.system( + "echo \"[User]\" > %s/var/lib/AccountsService/users/%s" % (root_mount_point, username)) + if default_desktop_environment != None: + os.system( + "echo \"XSession=%s\" >> %s/var/lib/AccountsService/users/%s" % (default_desktop_environment.desktop_file, root_mount_point, username)) + os.system( + "echo \"Icon=\" >> %s/var/lib/AccountsService/users/%s" % (root_mount_point, username)) if "kdm" in displaymanagers: # Systems with KDM as Desktop Manager @@ -256,14 +264,6 @@ def run(): libcalamares.utils.chroot_call(['passwd', '-l', 'gdm']) libcalamares.utils.chroot_call( ['chown', '-R', 'gdm:gdm', '/var/lib/gdm']) - if os.path.exists("%s/var/lib/AccountsService/users" % root_mount_point): - os.system( - "echo \"[User]\" > %s/var/lib/AccountsService/users/gdm" % root_mount_point) - if default_desktop_environment != None: - os.system( - "echo \"XSession=%s\" >> %s/var/lib/AccountsService/users/gdm" % (default_desktop_environment.desktop_file, root_mount_point)) - os.system( - "echo \"Icon=\" >> %s/var/lib/AccountsService/users/gdm" % root_mount_point) else: libcalamares.utils.debug("gdm selected but not installed") displaymanagers.remove("gdm") From 95e39e05faa97b047cc5e240c318715070c54ec0 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:03:20 +0100 Subject: [PATCH 06/11] displaymanager: Use libcalamares.utils.debug instead of print. Use libcalamares.utils.debug instead of print to output a debugging message during SDDM autologin setup. --- src/modules/displaymanager/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 2168662c3..5fc45ab72 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -171,7 +171,7 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m # Systems with Sddm as Desktop Manager sddm_conf_path = os.path.join(root_mount_point, "etc/sddm.conf") if os.path.isfile(sddm_conf_path): - print('SDDM config file exists') + libcalamares.utils.debug('SDDM config file exists') else: libcalamares.utils.check_chroot_call(["sh", "-c", "sddm --example-config > /etc/sddm.conf"]) text = [] From 90a25fdc62fd2166b7152eea66d2a5e5270173e3 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:14:33 +0100 Subject: [PATCH 07/11] displaymanager: Disable basic setup by default. Add a "basicSetup" boolean setting and default to leaving this kind of setup operations to the distribution packages (i.e., to "basicSetup: false"). --- .../displaymanager/displaymanager.conf | 4 + src/modules/displaymanager/main.py | 108 ++++++++++-------- 2 files changed, 63 insertions(+), 49 deletions(-) diff --git a/src/modules/displaymanager/displaymanager.conf b/src/modules/displaymanager/displaymanager.conf index 68f3e4eee..e9f9a6fe3 100644 --- a/src/modules/displaymanager/displaymanager.conf +++ b/src/modules/displaymanager/displaymanager.conf @@ -16,3 +16,7 @@ displaymanagers: # executable: "startkde" # desktop_file: "plasma" +#If true, try to ensure that the user, group, /var directory etc. for the +#display manager are set up correctly. This is normally done by the distribution +#packages, and best left to them. Therefore, it is disabled by default. +basicSetup: false diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 5fc45ab72..a3b106d29 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -217,6 +217,11 @@ def run(): else: default_desktop_environment = find_desktop_environment(root_mount_point) + if "basicSetup" in libcalamares.job.configuration: + enable_basic_setup = libcalamares.job.configuration["basicSetup"] + else: + enable_basic_setup = False + # Setup slim if "slim" in displaymanagers: if not os.path.exists("%s/usr/bin/slim" % root_mount_point): @@ -232,22 +237,23 @@ def run(): # setup lightdm if "lightdm" in displaymanagers: if os.path.exists("%s/usr/bin/lightdm" % root_mount_point): - libcalamares.utils.chroot_call(['mkdir', '-p', '/run/lightdm']) - libcalamares.utils.chroot_call(['getent', 'group', 'lightdm']) - libcalamares.utils.chroot_call( - ['groupadd', '-g', '620', 'lightdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"', - '-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm', - '-s', '/usr/bin/nologin', 'lightdm']) - libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm']) - libcalamares.utils.chroot_call( - ['chown', '-R', 'lightdm:lightdm', '/run/lightdm']) + if enable_basic_setup: + libcalamares.utils.chroot_call(['mkdir', '-p', '/run/lightdm']) + libcalamares.utils.chroot_call(['getent', 'group', 'lightdm']) + libcalamares.utils.chroot_call( + ['groupadd', '-g', '620', 'lightdm']) + libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) + libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"', + '-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm', + '-s', '/usr/bin/nologin', 'lightdm']) + libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm']) + libcalamares.utils.chroot_call( + ['chown', '-R', 'lightdm:lightdm', '/run/lightdm']) + libcalamares.utils.chroot_call( + ['chmod', '+r' '/etc/lightdm/lightdm.conf']) if default_desktop_environment != None: os.system( "sed -i -e 's/^.*user-session=.*/user-session=%s/' %s/etc/lightdm/lightdm.conf" % (default_desktop_environment.desktop_file, root_mount_point)) - libcalamares.utils.chroot_call( - ['chmod', '+r' '/etc/lightdm/lightdm.conf']) else: libcalamares.utils.debug("lightdm selected but not installed") displaymanagers.remove("lightdm") @@ -255,15 +261,16 @@ def run(): # Setup gdm if "gdm" in displaymanagers: if os.path.exists("%s/usr/bin/gdm" % root_mount_point): - libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"', - '-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm', - '-s', '/usr/bin/nologin', 'gdm']) - libcalamares.utils.chroot_call(['passwd', '-l', 'gdm']) - libcalamares.utils.chroot_call( - ['chown', '-R', 'gdm:gdm', '/var/lib/gdm']) + if enable_basic_setup: + libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) + libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm']) + libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) + libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"', + '-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm', + '-s', '/usr/bin/nologin', 'gdm']) + libcalamares.utils.chroot_call(['passwd', '-l', 'gdm']) + libcalamares.utils.chroot_call( + ['chown', '-R', 'gdm:gdm', '/var/lib/gdm']) else: libcalamares.utils.debug("gdm selected but not installed") displaymanagers.remove("gdm") @@ -271,16 +278,17 @@ def run(): # Setup mdm if "mdm" in displaymanagers: if os.path.exists("%s/usr/bin/mdm" % root_mount_point): - libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"', - '-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm', - '-s', '/usr/bin/nologin', 'mdm']) - libcalamares.utils.chroot_call(['passwd', '-l', 'mdm']) - libcalamares.utils.chroot_call( - ['chown', 'root:mdm', '/var/lib/mdm']) - libcalamares.utils.chroot_call(['chmod', '1770', '/var/lib/mdm']) + if enable_basic_setup: + libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) + libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm']) + libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) + libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"', + '-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm', + '-s', '/usr/bin/nologin', 'mdm']) + libcalamares.utils.chroot_call(['passwd', '-l', 'mdm']) + libcalamares.utils.chroot_call( + ['chown', 'root:mdm', '/var/lib/mdm']) + libcalamares.utils.chroot_call(['chmod', '1770', '/var/lib/mdm']) if default_desktop_environment != None: os.system( "sed -i 's|default.desktop|%s.desktop|g' %s/etc/mdm/custom.conf" % (default_desktop_environment.desktop_file, root_mount_point)) @@ -291,16 +299,17 @@ def run(): # Setup lxdm if "lxdm" in displaymanagers: if os.path.exists("%s/usr/bin/lxdm" % root_mount_point): - libcalamares.utils.chroot_call(['groupadd', '--system', 'lxdm']) + if enable_basic_setup: + libcalamares.utils.chroot_call(['groupadd', '--system', 'lxdm']) + libcalamares.utils.chroot_call( + ['chgrp', '-R', 'lxdm', '/var/lib/lxdm']) + libcalamares.utils.chroot_call( + ['chgrp', 'lxdm', '/etc/lxdm/lxdm.conf']) + libcalamares.utils.chroot_call( + ['chmod', '+r', '/etc/lxdm/lxdm.conf']) if default_desktop_environment != None: os.system( "sed -i -e 's|^.*session=.*|session=%s|' %s/etc/lxdm/lxdm.conf" % (default_desktop_environment.executable, root_mount_point)) - libcalamares.utils.chroot_call( - ['chgrp', '-R', 'lxdm', '/var/lib/lxdm']) - libcalamares.utils.chroot_call( - ['chgrp', 'lxdm', '/etc/lxdm/lxdm.conf']) - libcalamares.utils.chroot_call( - ['chmod', '+r', '/etc/lxdm/lxdm.conf']) else: libcalamares.utils.debug("lxdm selected but not installed") displaymanagers.remove("lxdm") @@ -308,16 +317,17 @@ def run(): # Setup kdm if "kdm" in displaymanagers: if os.path.exists("%s/usr/bin/kdm" % root_mount_point): - libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) - libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d', - '/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm']) - libcalamares.utils.chroot_call( - ['chown', '-R', '135:135', 'var/lib/kdm']) - libcalamares.utils.chroot_call( - ['xdg-icon-resource', 'forceupdate', '--theme', 'hicolor']) - libcalamares.utils.chroot_call(['update-desktop-database', '-q']) + if enable_basic_setup: + libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) + libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm']) + libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) + libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d', + '/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm']) + libcalamares.utils.chroot_call( + ['chown', '-R', '135:135', 'var/lib/kdm']) + libcalamares.utils.chroot_call( + ['xdg-icon-resource', 'forceupdate', '--theme', 'hicolor']) + libcalamares.utils.chroot_call(['update-desktop-database', '-q']) else: libcalamares.utils.debug("kdm selected but not installed") displaymanagers.remove("kdm") From a0bb108486414e9618e9744ef8b83032c24e3050 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:20:55 +0100 Subject: [PATCH 08/11] displaymanager: Fix the use of getent in the basic setup. This also matches what the original shell script from Manjaro did. --- src/modules/displaymanager/main.py | 51 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index a3b106d29..6af3ab132 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -239,13 +239,13 @@ def run(): if os.path.exists("%s/usr/bin/lightdm" % root_mount_point): if enable_basic_setup: libcalamares.utils.chroot_call(['mkdir', '-p', '/run/lightdm']) - libcalamares.utils.chroot_call(['getent', 'group', 'lightdm']) - libcalamares.utils.chroot_call( - ['groupadd', '-g', '620', 'lightdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"', - '-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm', - '-s', '/usr/bin/nologin', 'lightdm']) + if libcalamares.utils.chroot_call(['getent', 'group', 'lightdm']) != 0: + libcalamares.utils.chroot_call( + ['groupadd', '-g', '620', 'lightdm']) + if libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) != 0: + libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"', + '-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm', + '-s', '/usr/bin/nologin', 'lightdm']) libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm']) libcalamares.utils.chroot_call( ['chown', '-R', 'lightdm:lightdm', '/run/lightdm']) @@ -262,12 +262,12 @@ def run(): if "gdm" in displaymanagers: if os.path.exists("%s/usr/bin/gdm" % root_mount_point): if enable_basic_setup: - libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"', - '-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm', - '-s', '/usr/bin/nologin', 'gdm']) + if libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) != 0: + libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm']) + if libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) != 0: + libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"', + '-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm', + '-s', '/usr/bin/nologin', 'gdm']) libcalamares.utils.chroot_call(['passwd', '-l', 'gdm']) libcalamares.utils.chroot_call( ['chown', '-R', 'gdm:gdm', '/var/lib/gdm']) @@ -279,12 +279,12 @@ def run(): if "mdm" in displaymanagers: if os.path.exists("%s/usr/bin/mdm" % root_mount_point): if enable_basic_setup: - libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) - libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"', - '-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm', - '-s', '/usr/bin/nologin', 'mdm']) + if libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) != 0: + libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm']) + if libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) != 0: + libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"', + '-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm', + '-s', '/usr/bin/nologin', 'mdm']) libcalamares.utils.chroot_call(['passwd', '-l', 'mdm']) libcalamares.utils.chroot_call( ['chown', 'root:mdm', '/var/lib/mdm']) @@ -300,7 +300,8 @@ def run(): if "lxdm" in displaymanagers: if os.path.exists("%s/usr/bin/lxdm" % root_mount_point): if enable_basic_setup: - libcalamares.utils.chroot_call(['groupadd', '--system', 'lxdm']) + if libcalamares.utils.chroot_call(['getent', 'group', 'lxdm']) != 0: + libcalamares.utils.chroot_call(['groupadd', '--system', 'lxdm']) libcalamares.utils.chroot_call( ['chgrp', '-R', 'lxdm', '/var/lib/lxdm']) libcalamares.utils.chroot_call( @@ -318,11 +319,11 @@ def run(): if "kdm" in displaymanagers: if os.path.exists("%s/usr/bin/kdm" % root_mount_point): if enable_basic_setup: - libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) - libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm']) - libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) - libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d', - '/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm']) + if libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) != 0: + libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm']) + if libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) != 0: + libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d', + '/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm']) libcalamares.utils.chroot_call( ['chown', '-R', '135:135', 'var/lib/kdm']) libcalamares.utils.chroot_call( From a54067f70961e57043f6c9531a3509b3f30c4ec3 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:25:44 +0100 Subject: [PATCH 09/11] displaymanager: Don't run xdg-icon-resource and update-desktop-database. Don't run xdg-icon-resource and update-desktop-database in the basic setup for KDM. These tools have absolutely nothing to do with KDM. KDM does not ship any icons in the hicolor theme, nor a .desktop file (let alone one that handles any MIME type, the only case in which update-desktop-database is needed). I know the original shell script from Manjaro called these when setting up KDM, but this is really the wrong place. If you need to call these, they need to go into another module, and you also have to call them independently of the selected display manager. --- src/modules/displaymanager/main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 6af3ab132..e2d7d98a7 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -326,9 +326,6 @@ def run(): '/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm']) libcalamares.utils.chroot_call( ['chown', '-R', '135:135', 'var/lib/kdm']) - libcalamares.utils.chroot_call( - ['xdg-icon-resource', 'forceupdate', '--theme', 'hicolor']) - libcalamares.utils.chroot_call(['update-desktop-database', '-q']) else: libcalamares.utils.debug("kdm selected but not installed") displaymanagers.remove("kdm") From b411a66bafee6ddba37a14593bfcf7721e5f0ec3 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 1 Dec 2014 03:30:42 +0100 Subject: [PATCH 10/11] displaymanager: Make the settings follow the naming convention. Make the defaultDesktopEnvironment and desktopFile settings in displaymanager.conf follow the naming convention used in the other .conf files. --- src/modules/displaymanager/displaymanager.conf | 4 ++-- src/modules/displaymanager/main.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/displaymanager/displaymanager.conf b/src/modules/displaymanager/displaymanager.conf index e9f9a6fe3..59ad061dc 100644 --- a/src/modules/displaymanager/displaymanager.conf +++ b/src/modules/displaymanager/displaymanager.conf @@ -12,9 +12,9 @@ displaymanagers: - kdm #Enable the following settings to force a desktop environment in your displaymanager configuration file: -#default_desktop_environment: +#defaultDesktopEnvironment: # executable: "startkde" -# desktop_file: "plasma" +# desktopFile: "plasma" #If true, try to ensure that the user, group, /var directory etc. for the #display manager are set up correctly. This is normally done by the distribution diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index e2d7d98a7..859589c2b 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -212,8 +212,8 @@ def run(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") if "default_desktop_environment" in libcalamares.job.configuration: - entry = libcalamares.job.configuration["default_desktop_environment"] - default_desktop_environment = DesktopEnvironment(entry["executable"], entry["desktop_file"]) + entry = libcalamares.job.configuration["defaultDesktopEnvironment"] + default_desktop_environment = DesktopEnvironment(entry["executable"], entry["desktopFile"]) else: default_desktop_environment = find_desktop_environment(root_mount_point) From 2955c0a5a858897e43f3f7d613e8559247c5202b Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Fri, 5 Dec 2014 22:20:54 +0100 Subject: [PATCH 11/11] displaymanager: Also look for display managers in /usr/sbin. --- src/modules/displaymanager/main.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index 859589c2b..7ae7c78eb 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -49,6 +49,9 @@ def find_desktop_environment(root_mount_point): return desktop_environment return None +def have_dm(dm_name, root_mount_point): + return os.path.exists("%s/usr/bin/%s" % (root_mount_point, dm_name)) or os.path.exists("%s/usr/sbin/%s" % (root_mount_point, dm_name)) + def set_autologin(username, displaymanagers, default_desktop_environment, root_mount_point): """ Enables automatic login for the installed desktop managers """ @@ -224,19 +227,19 @@ def run(): # Setup slim if "slim" in displaymanagers: - if not os.path.exists("%s/usr/bin/slim" % root_mount_point): + if not have_dm("slim", root_mount_point): libcalamares.utils.debug("slim selected but not installed") displaymanagers.remove("slim") # Setup sddm if "sddm" in displaymanagers: - if not os.path.exists("%s/usr/bin/sddm" % root_mount_point): + if not have_dm("sddm", root_mount_point): libcalamares.utils.debug("sddm selected but not installed") displaymanagers.remove("sddm") # setup lightdm if "lightdm" in displaymanagers: - if os.path.exists("%s/usr/bin/lightdm" % root_mount_point): + if have_dm("lightdm", root_mount_point): if enable_basic_setup: libcalamares.utils.chroot_call(['mkdir', '-p', '/run/lightdm']) if libcalamares.utils.chroot_call(['getent', 'group', 'lightdm']) != 0: @@ -260,7 +263,7 @@ def run(): # Setup gdm if "gdm" in displaymanagers: - if os.path.exists("%s/usr/bin/gdm" % root_mount_point): + if have_dm("gdm", root_mount_point): if enable_basic_setup: if libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) != 0: libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm']) @@ -277,7 +280,7 @@ def run(): # Setup mdm if "mdm" in displaymanagers: - if os.path.exists("%s/usr/bin/mdm" % root_mount_point): + if have_dm("mdm", root_mount_point): if enable_basic_setup: if libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) != 0: libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm']) @@ -298,7 +301,7 @@ def run(): # Setup lxdm if "lxdm" in displaymanagers: - if os.path.exists("%s/usr/bin/lxdm" % root_mount_point): + if have_dm("lxdm", root_mount_point): if enable_basic_setup: if libcalamares.utils.chroot_call(['getent', 'group', 'lxdm']) != 0: libcalamares.utils.chroot_call(['groupadd', '--system', 'lxdm']) @@ -317,7 +320,7 @@ def run(): # Setup kdm if "kdm" in displaymanagers: - if os.path.exists("%s/usr/bin/kdm" % root_mount_point): + if have_dm("kdm", root_mount_point): if enable_basic_setup: if libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) != 0: libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm'])