Merge branch 'master' of https://github.com/calamares/calamares into development
This commit is contained in:
commit
b3143d057c
@ -89,14 +89,15 @@ def have_dm(dm_name, root_mount_point):
|
|||||||
|
|
||||||
|
|
||||||
def set_autologin(username,
|
def set_autologin(username,
|
||||||
displaymanagers,
|
displaymanager,
|
||||||
default_desktop_environment,
|
default_desktop_environment,
|
||||||
root_mount_point):
|
root_mount_point):
|
||||||
"""
|
"""
|
||||||
Enables automatic login for the installed desktop managers.
|
Enables automatic login for the installed desktop managers.
|
||||||
|
|
||||||
:param username:
|
:param username:
|
||||||
:param displaymanagers:
|
:param displaymanager: str
|
||||||
|
The displaymanager for which to configure autologin.
|
||||||
:param default_desktop_environment:
|
:param default_desktop_environment:
|
||||||
:param root_mount_point:
|
:param root_mount_point:
|
||||||
"""
|
"""
|
||||||
@ -105,7 +106,7 @@ def set_autologin(username,
|
|||||||
if username is None:
|
if username is None:
|
||||||
do_autologin = False
|
do_autologin = False
|
||||||
|
|
||||||
if "mdm" in displaymanagers:
|
if "mdm" == displaymanager:
|
||||||
# Systems with MDM as Desktop Manager
|
# Systems with MDM as Desktop Manager
|
||||||
mdm_conf_path = os.path.join(root_mount_point, "etc/mdm/custom.conf")
|
mdm_conf_path = os.path.join(root_mount_point, "etc/mdm/custom.conf")
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ def set_autologin(username,
|
|||||||
else:
|
else:
|
||||||
mdm_conf.write('AutomaticLoginEnable=False\n')
|
mdm_conf.write('AutomaticLoginEnable=False\n')
|
||||||
|
|
||||||
if "gdm" in displaymanagers:
|
if "gdm" == displaymanager:
|
||||||
# Systems with GDM as Desktop Manager
|
# Systems with GDM as Desktop Manager
|
||||||
gdm_conf_path = os.path.join(root_mount_point, "etc/gdm/custom.conf")
|
gdm_conf_path = os.path.join(root_mount_point, "etc/gdm/custom.conf")
|
||||||
|
|
||||||
@ -176,40 +177,37 @@ def set_autologin(username,
|
|||||||
else:
|
else:
|
||||||
gdm_conf.write('AutomaticLoginEnable=False\n')
|
gdm_conf.write('AutomaticLoginEnable=False\n')
|
||||||
|
|
||||||
if (do_autologin
|
if (do_autologin):
|
||||||
and os.path.exists("{!s}/var/lib/AccountsService/users".format(
|
accountservice_dir = "{!s}/var/lib/AccountsService/users".format(
|
||||||
root_mount_point
|
root_mount_point
|
||||||
)
|
)
|
||||||
)):
|
userfile_path = "{!s}/{!s}".format(accountservice_dir, username)
|
||||||
os.system(
|
if os.path.exists(accountservice_dir):
|
||||||
"echo \"[User]\" > "
|
with open(userfile_path, "w") as userfile:
|
||||||
"{!s}/var/lib/AccountsService/users/{!s}".format(
|
userfile.write("[User]\n")
|
||||||
root_mount_point,
|
|
||||||
username
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if default_desktop_environment is not None:
|
if default_desktop_environment is not None:
|
||||||
os.system(
|
userfile.write("XSession={!s}\n".format(
|
||||||
"echo \"XSession={!s}\" >> "
|
default_desktop_environment.desktop_file))
|
||||||
"{!s}/var/lib/AccountsService/users/{!s}".format(
|
|
||||||
default_desktop_environment.desktop_file,
|
|
||||||
root_mount_point, username
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
os.system(
|
userfile.write("Icon=\n")
|
||||||
"echo \"Icon=\" >> "
|
|
||||||
"{!s}/var/lib/AccountsService/users/{!s}".format(
|
|
||||||
root_mount_point, username
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if "kdm" in displaymanagers:
|
if "kdm" == displaymanager:
|
||||||
# Systems with KDM as Desktop Manager
|
# Systems with KDM as Desktop Manager
|
||||||
kdm_conf_path = os.path.join(
|
kdm_conf_path = os.path.join(
|
||||||
root_mount_point, "usr/share/config/kdm/kdmrc"
|
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 = []
|
text = []
|
||||||
|
|
||||||
if os.path.exists(kdm_conf_path):
|
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)
|
"KDM config file {!s} does not exist".format(kdm_conf_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
if "lxdm" in displaymanagers:
|
if "lxdm" == displaymanager:
|
||||||
# Systems with LXDM as Desktop Manager
|
# Systems with LXDM as Desktop Manager
|
||||||
lxdm_conf_path = os.path.join(root_mount_point, "etc/lxdm/lxdm.conf")
|
lxdm_conf_path = os.path.join(root_mount_point, "etc/lxdm/lxdm.conf")
|
||||||
text = []
|
text = []
|
||||||
@ -258,7 +256,7 @@ def set_autologin(username,
|
|||||||
"LXDM config file {!s} does not exist".format(lxdm_conf_path)
|
"LXDM config file {!s} does not exist".format(lxdm_conf_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
if "lightdm" in displaymanagers:
|
if "lightdm" == displaymanager:
|
||||||
# Systems with LightDM as Desktop Manager
|
# Systems with LightDM as Desktop Manager
|
||||||
# Ideally, we should use configparser for the ini conf file,
|
# Ideally, we should use configparser for the ini conf file,
|
||||||
# but we just do a simple text replacement for now, as it
|
# 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
|
# Systems with Slim as Desktop Manager
|
||||||
slim_conf_path = os.path.join(root_mount_point, "etc/slim.conf")
|
slim_conf_path = os.path.join(root_mount_point, "etc/slim.conf")
|
||||||
text = []
|
text = []
|
||||||
@ -316,7 +314,7 @@ def set_autologin(username,
|
|||||||
"SLIM config file {!s} does not exist".format(slim_conf_path)
|
"SLIM config file {!s} does not exist".format(slim_conf_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
if "sddm" in displaymanagers:
|
if "sddm" == displaymanager:
|
||||||
# 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")
|
||||||
|
|
||||||
@ -618,8 +616,15 @@ def run():
|
|||||||
|
|
||||||
libcalamares.globalstorage.insert("displayManagers", displaymanagers)
|
libcalamares.globalstorage.insert("displayManagers", displaymanagers)
|
||||||
|
|
||||||
return set_autologin(
|
dm_setup_message = []
|
||||||
username, displaymanagers,
|
for dm in displaymanagers:
|
||||||
default_desktop_environment,
|
dm_message = set_autologin(
|
||||||
root_mount_point
|
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 |
@ -1,6 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>images/arrow-up.png</file>
|
|
||||||
<file>images/arrow-down.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
Loading…
Reference in New Issue
Block a user