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
@ -136,9 +136,11 @@ def set_autologin(username, displaymanagers, root_mount_point):
|
|||||||
# Systems with Sddm as Desktop Manager
|
# Systems with Sddm as Desktop Manager
|
||||||
sddm_conf_path = os.path.join(root_mount_point, "etc/sddm.conf")
|
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 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)
|
check_chroot_call("sddm --example-config > etc/sddm.conf", shell=True)
|
||||||
text = []
|
text = []
|
||||||
if os.path.exists(sddm_conf_path):
|
|
||||||
with open(sddm_conf_path, 'r') as sddm_conf:
|
with open(sddm_conf_path, 'r') as sddm_conf:
|
||||||
text = sddm_conf.readlines()
|
text = sddm_conf.readlines()
|
||||||
with open(sddm_conf_path, 'w') as sddm_conf:
|
with open(sddm_conf_path, 'w') as sddm_conf:
|
||||||
@ -146,8 +148,6 @@ def set_autologin(username, displaymanagers, root_mount_point):
|
|||||||
if 'User=' in line:
|
if 'User=' in line:
|
||||||
line = 'User={}\n'.format(username)
|
line = 'User={}\n'.format(username)
|
||||||
sddm_conf.write(line)
|
sddm_conf.write(line)
|
||||||
else:
|
|
||||||
return "Cannot write SDDM configuration file", "SDDM config file %s does not exist" % sddm_conf_path
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user