mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
proper check for existing sddm.conf
second set of if/else is obsolete with this, sddm.conf always exists at this point
This commit is contained in:
parent
231c93a513
commit
e26335d2da
1 changed files with 11 additions and 11 deletions
|
@ -136,18 +136,18 @@ def set_autologin(username, displaymanagers, root_mount_point):
|
|||
# Systems with Sddm as Desktop Manager
|
||||
sddm_conf_path = os.path.join(root_mount_point, "etc/sddm.conf")
|
||||
if sddm_conf_path != os.path.join(root_mount_point, "etc/sddm.conf"):
|
||||
if os.path.isfile(sddm_conf_path):
|
||||
print('SDDM config file exists')
|
||||
else:
|
||||
check_chroot_call("sddm --example-config > etc/sddm.conf", shell=True)
|
||||
text = []
|
||||
if os.path.exists(sddm_conf_path):
|
||||
with open(sddm_conf_path, 'r') as sddm_conf:
|
||||
text = sddm_conf.readlines()
|
||||
with open(sddm_conf_path, 'w') as sddm_conf:
|
||||
for line in text:
|
||||
if 'User=' in line:
|
||||
line = 'User={}\n'.format(username)
|
||||
sddm_conf.write(line)
|
||||
else:
|
||||
return "Cannot write SDDM configuration file", "SDDM config file %s does not exist" % sddm_conf_path
|
||||
with open(sddm_conf_path, 'r') as sddm_conf:
|
||||
text = sddm_conf.readlines()
|
||||
with open(sddm_conf_path, 'w') as sddm_conf:
|
||||
for line in text:
|
||||
if 'User=' in line:
|
||||
line = 'User={}\n'.format(username)
|
||||
sddm_conf.write(line)
|
||||
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue