SUSE DM: add special case configuring autologin in sysconfig (openSUSE)

FIXES #582
This commit is contained in:
Adriaan de Groot 2017-07-10 10:14:28 -04:00 committed by Philip
parent c150c61c59
commit 9860922496
2 changed files with 21 additions and 0 deletions

View File

@ -20,3 +20,7 @@ displaymanagers:
#display manager are set up correctly. This is normally done by the distribution #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. #packages, and best left to them. Therefore, it is disabled by default.
basicSetup: false basicSetup: false
#If true, setup autologin for openSUSE. This only makes sense on openSUSE
#derivatives or other systems where /etc/sysconfig/displaymanager exists.
sysconfigSetup: false

View File

@ -359,6 +359,18 @@ def set_autologin(username,
with open(sddm_conf_path, 'w') as sddm_config_file: with open(sddm_conf_path, 'w') as sddm_config_file:
sddm_config.write(sddm_config_file, space_around_delimiters=False) sddm_config.write(sddm_config_file, space_around_delimiters=False)
if "sysconfig" == displaymanager:
dmauto = "DISPLAYMANAGER_AUTOLOGIN"
os.system(
"sed -i -e 's|^{!s}=.*|{!s}=\"{!s}\"|' "
"{!s}/etc/sysconfig/displaymanager".format(
dmauto, dmauto,
username if do_autologin else "",
root_mount_point
)
)
return None return None
@ -666,6 +678,11 @@ def run():
) )
if dm_message is not None: if dm_message is not None:
dm_setup_message.append("{!s}: {!s}".format(*dm_message)) dm_setup_message.append("{!s}: {!s}".format(*dm_message))
if ("sysconfigSetup" in libcalamares.job.configuration
and libcalamares.job.configuration["sysconfigSetup"]):
set_autologin(username, "sysconfig", None, root_mount_point)
if dm_setup_message: if dm_setup_message:
return ("Display manager configuration was incomplete", return ("Display manager configuration was incomplete",
"\n".join(dm_setup_message)) "\n".join(dm_setup_message))