Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip 2017-06-20 00:28:59 +02:00
commit b3143d057c
4 changed files with 43 additions and 44 deletions

View File

@ -89,14 +89,15 @@ def have_dm(dm_name, root_mount_point):
def set_autologin(username,
displaymanagers,
displaymanager,
default_desktop_environment,
root_mount_point):
"""
Enables automatic login for the installed desktop managers.
:param username:
:param displaymanagers:
:param displaymanager: str
The displaymanager for which to configure autologin.
:param default_desktop_environment:
:param root_mount_point:
"""
@ -105,7 +106,7 @@ def set_autologin(username,
if username is None:
do_autologin = False
if "mdm" in displaymanagers:
if "mdm" == displaymanager:
# Systems with MDM as Desktop Manager
mdm_conf_path = os.path.join(root_mount_point, "etc/mdm/custom.conf")
@ -142,7 +143,7 @@ def set_autologin(username,
else:
mdm_conf.write('AutomaticLoginEnable=False\n')
if "gdm" in displaymanagers:
if "gdm" == displaymanager:
# Systems with GDM as Desktop Manager
gdm_conf_path = os.path.join(root_mount_point, "etc/gdm/custom.conf")
@ -176,40 +177,37 @@ def set_autologin(username,
else:
gdm_conf.write('AutomaticLoginEnable=False\n')
if (do_autologin
and os.path.exists("{!s}/var/lib/AccountsService/users".format(
if (do_autologin):
accountservice_dir = "{!s}/var/lib/AccountsService/users".format(
root_mount_point
)
)):
os.system(
"echo \"[User]\" > "
"{!s}/var/lib/AccountsService/users/{!s}".format(
root_mount_point,
username
)
)
userfile_path = "{!s}/{!s}".format(accountservice_dir, username)
if os.path.exists(accountservice_dir):
with open(userfile_path, "w") as userfile:
userfile.write("[User]\n")
if default_desktop_environment is not None:
os.system(
"echo \"XSession={!s}\" >> "
"{!s}/var/lib/AccountsService/users/{!s}".format(
default_desktop_environment.desktop_file,
root_mount_point, username
)
)
userfile.write("XSession={!s}\n".format(
default_desktop_environment.desktop_file))
os.system(
"echo \"Icon=\" >> "
"{!s}/var/lib/AccountsService/users/{!s}".format(
root_mount_point, username
)
)
userfile.write("Icon=\n")
if "kdm" in displaymanagers:
if "kdm" == displaymanager:
# Systems with KDM as Desktop Manager
kdm_conf_path = os.path.join(
root_mount_point, "usr/share/config/kdm/kdmrc"
)
# Check which path is in use: SUSE does something else.
# Also double-check the default setting. Pick the first
# one that exists in the target.
for candidate_kdmrc in (
"usr/share/config/kdm/kdmrc",
"usr/share/kde4/config/kdm/kdmrc",
):
p = os.path.join(root_mount_point, candidate_kdmrc)
if os.path.exists(p):
kdm_conf_path = p
break
text = []
if os.path.exists(kdm_conf_path):
@ -234,7 +232,7 @@ def set_autologin(username,
"KDM config file {!s} does not exist".format(kdm_conf_path)
)
if "lxdm" in displaymanagers:
if "lxdm" == displaymanager:
# Systems with LXDM as Desktop Manager
lxdm_conf_path = os.path.join(root_mount_point, "etc/lxdm/lxdm.conf")
text = []
@ -258,7 +256,7 @@ def set_autologin(username,
"LXDM config file {!s} does not exist".format(lxdm_conf_path)
)
if "lightdm" in displaymanagers:
if "lightdm" == displaymanager:
# Systems with LightDM as Desktop Manager
# Ideally, we should use configparser for the ini conf file,
# but we just do a simple text replacement for now, as it
@ -289,7 +287,7 @@ def set_autologin(username,
)
)
if "slim" in displaymanagers:
if "slim" == displaymanager:
# Systems with Slim as Desktop Manager
slim_conf_path = os.path.join(root_mount_point, "etc/slim.conf")
text = []
@ -316,7 +314,7 @@ def set_autologin(username,
"SLIM config file {!s} does not exist".format(slim_conf_path)
)
if "sddm" in displaymanagers:
if "sddm" == displaymanager:
# Systems with Sddm as Desktop Manager
sddm_conf_path = os.path.join(root_mount_point, "etc/sddm.conf")
@ -618,8 +616,15 @@ def run():
libcalamares.globalstorage.insert("displayManagers", displaymanagers)
return set_autologin(
username, displaymanagers,
dm_setup_message = []
for dm in displaymanagers:
dm_message = set_autologin(
username, dm,
default_desktop_environment,
root_mount_point
)
if dm_message is not None:
dm_setup_message.append("{!s}: {!s}".format(*dm_message))
if dm_setup_message:
return ("Display manager configuration was incomplete",
"\n".join(dm_setup_message))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>images/arrow-up.png</file>
<file>images/arrow-down.png</file>
</qresource>
</RCC>