Displaymanager: simplify gdm configuration.
Replace calling out to shell to run echo redirected to a file by opening the file and writing to it.
This commit is contained in:
parent
182c3bdcd0
commit
c7a323e466
@ -177,34 +177,20 @@ 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" == displaymanager:
|
if "kdm" == displaymanager:
|
||||||
# Systems with KDM as Desktop Manager
|
# Systems with KDM as Desktop Manager
|
||||||
|
Loading…
Reference in New Issue
Block a user