mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 03:15:44 -05:00
Made amendments based on review
Fixed 'prepend' terminology in comments, restored old loop as it seems to work for me now in overwriting the file as one overall multiline instead of overwriting the file with each line at a time, code simplification based on review comments... credits-adding will come in the next commit.
This commit is contained in:
parent
3ecd031d9d
commit
c0d61b666d
1 changed files with 3 additions and 8 deletions
|
@ -495,26 +495,21 @@ class DMlightdm(DisplayManager):
|
||||||
text = lightdm_conf.readlines()
|
text = lightdm_conf.readlines()
|
||||||
# Check to make sure [SeatDefaults] or [Seat:*] is in the config,
|
# Check to make sure [SeatDefaults] or [Seat:*] is in the config,
|
||||||
# otherwise we'll risk malforming the config
|
# otherwise we'll risk malforming the config
|
||||||
if not '[SeatDefaults]' in text and not '[Seat:*]' in text:
|
addseat = '[SeatDefaults]' not in text and '[Seat:*]' not in text
|
||||||
addseat = True
|
|
||||||
|
|
||||||
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
with open(lightdm_conf_path, 'w') as lightdm_conf:
|
||||||
if addseat:
|
if addseat:
|
||||||
# Append Seat line to start of file rather than leaving it without one
|
# Prepend Seat line to start of file rather than leaving it without one
|
||||||
# This keeps the config from being malformed for LightDM
|
# This keeps the config from being malformed for LightDM
|
||||||
text = ["[Seat:*]\n"] + text
|
text = ["[Seat:*]\n"] + text
|
||||||
loopcount = 0
|
|
||||||
for line in text:
|
for line in text:
|
||||||
if 'autologin-user=' in line:
|
if 'autologin-user=' in line:
|
||||||
if do_autologin:
|
if do_autologin:
|
||||||
line = "autologin-user={!s}\n".format(username)
|
line = "autologin-user={!s}\n".format(username)
|
||||||
else:
|
else:
|
||||||
line = "#autologin-user=\n"
|
line = "#autologin-user=\n"
|
||||||
text[loopcount] = line
|
|
||||||
loopcount += 1
|
|
||||||
|
|
||||||
lightdm_conf.write("".join(text))
|
lightdm_conf.write(line)
|
||||||
loopcount = 0
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue