Merge pull request #1123 from feren/patch-1
Better LightDM Autologin Support
This commit is contained in:
commit
1c364ea465
3
CHANGES
3
CHANGES
@ -16,6 +16,7 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
|
|
||||||
This release contains contributions from (alphabetically by first name):
|
This release contains contributions from (alphabetically by first name):
|
||||||
- Arnaud Ferraris
|
- Arnaud Ferraris
|
||||||
|
- Dominic Hayes (feren)
|
||||||
|
|
||||||
## Core ##
|
## Core ##
|
||||||
|
|
||||||
@ -25,6 +26,8 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
## Modules ##
|
## Modules ##
|
||||||
|
|
||||||
* All of the Python-based modules now have translations enabled.
|
* All of the Python-based modules now have translations enabled.
|
||||||
|
* *Displaymanager* module has improved support for LightDM configuration.
|
||||||
|
(Thanks to Dominic, FerenOS)
|
||||||
* *Partition* module has additional checks for validity partition layouts.
|
* *Partition* module has additional checks for validity partition layouts.
|
||||||
(Thanks to Arnaud)
|
(Thanks to Arnaud)
|
||||||
* *Welcome* module has improved usability: a standard icon
|
* *Welcome* module has improved usability: a standard icon
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
|
# Copyright 2019 Dominic Hayes <ferenosdev@outlook.com>
|
||||||
# Copyright 2014-2018, Philip Müller <philm@manjaro.org>
|
# Copyright 2014-2018, Philip Müller <philm@manjaro.org>
|
||||||
# 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>
|
||||||
@ -487,12 +488,21 @@ class DMlightdm(DisplayManager):
|
|||||||
self.root_mount_point, "etc/lightdm/lightdm.conf"
|
self.root_mount_point, "etc/lightdm/lightdm.conf"
|
||||||
)
|
)
|
||||||
text = []
|
text = []
|
||||||
|
addseat = False
|
||||||
|
loopcount = 0
|
||||||
|
|
||||||
if os.path.exists(lightdm_conf_path):
|
if os.path.exists(lightdm_conf_path):
|
||||||
with open(lightdm_conf_path, 'r') as lightdm_conf:
|
with open(lightdm_conf_path, 'r') as lightdm_conf:
|
||||||
text = lightdm_conf.readlines()
|
text = lightdm_conf.readlines()
|
||||||
|
# Check to make sure [SeatDefaults] or [Seat:*] is in the config,
|
||||||
|
# otherwise we'll risk malforming the config
|
||||||
|
addseat = '[SeatDefaults]' not in text and '[Seat:*]' not in text
|
||||||
|
|
||||||
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
||||||
|
if addseat:
|
||||||
|
# Prepend Seat line to start of file rather than leaving it without one
|
||||||
|
# This keeps the config from being malformed for LightDM
|
||||||
|
text = ["[Seat:*]\n"] + text
|
||||||
for line in text:
|
for line in text:
|
||||||
if 'autologin-user=' in line:
|
if 'autologin-user=' in line:
|
||||||
if do_autologin:
|
if do_autologin:
|
||||||
@ -504,14 +514,14 @@ class DMlightdm(DisplayManager):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# Create a new lightdm.conf file; this is documented to be
|
# Create a new lightdm.conf file; this is documented to be
|
||||||
# read last, after aeverything in lightdm.conf.d/
|
# read last, after everything in lightdm.conf.d/
|
||||||
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
||||||
if do_autologin:
|
if do_autologin:
|
||||||
lightdm_conf.write(
|
lightdm_conf.write(
|
||||||
"autologin-user={!s}\n".format(username))
|
"[Seat:*]\nautologin-user={!s}\n".format(username))
|
||||||
else:
|
else:
|
||||||
lightdm_conf.write(
|
lightdm_conf.write(
|
||||||
"#autologin-user=\n")
|
"[Seat:*]\n#autologin-user=\n")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return (
|
return (
|
||||||
_("Cannot write LightDM configuration file"),
|
_("Cannot write LightDM configuration file"),
|
||||||
|
Loading…
Reference in New Issue
Block a user