mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
fix(greetd): deal with no existing config
This commit is contained in:
parent
fbdb9e6779
commit
5701937883
1 changed files with 22 additions and 20 deletions
|
@ -838,22 +838,30 @@ class DMsddm(DisplayManager):
|
||||||
class DMgreetd(DisplayManager):
|
class DMgreetd(DisplayManager):
|
||||||
name = "greetd"
|
name = "greetd"
|
||||||
executable = "greetd"
|
executable = "greetd"
|
||||||
|
greeter_user = "greeter"
|
||||||
|
greeter_group = "greetd"
|
||||||
config_data = {}
|
config_data = {}
|
||||||
|
|
||||||
def os_path(self, path):
|
def os_path(self, path):
|
||||||
return os.path.join(self.root_mount_point, path)
|
return os.path.join(self.root_mount_point, path)
|
||||||
|
|
||||||
def config_path(self):
|
def config_path(self):
|
||||||
path = self.os_path("etc/greetd/config.toml")
|
return self.os_path("etc/greetd/config.toml")
|
||||||
if not os.path.exists(path):
|
|
||||||
open(path, 'a').close()
|
|
||||||
return path
|
|
||||||
|
|
||||||
def environments_path(self):
|
def environments_path(self):
|
||||||
return self.os_path("etc/greetd/environments")
|
return self.os_path("etc/greetd/environments")
|
||||||
|
|
||||||
def config_load(self):
|
def config_load(self):
|
||||||
self.config_data = toml.loads(self.config_path())
|
if (os.path.exists(self.config_path)):
|
||||||
|
self.config_data = toml.loads(self.config_path())
|
||||||
|
|
||||||
|
self.config_data['terminal'] = dict(vt = "next")
|
||||||
|
|
||||||
|
if not os.path.exists(self.config_data['default_session']):
|
||||||
|
self.config_data['default_session'] = {}
|
||||||
|
|
||||||
|
self.config_data['default_session']['user'] = self.greeter_user
|
||||||
|
|
||||||
return self.config_data
|
return self.config_data
|
||||||
|
|
||||||
def config_write(self):
|
def config_write(self):
|
||||||
|
@ -861,26 +869,23 @@ class DMgreetd(DisplayManager):
|
||||||
|
|
||||||
def basic_setup(self):
|
def basic_setup(self):
|
||||||
if libcalamares.utils.target_env_call(
|
if libcalamares.utils.target_env_call(
|
||||||
['getent', 'group', 'greetd']
|
['getent', 'group', self.greeter_group]
|
||||||
) != 0:
|
) != 0:
|
||||||
libcalamares.utils.target_env_call(
|
libcalamares.utils.target_env_call(
|
||||||
['groupadd', 'greetd']
|
['groupadd', self.greeter_group]
|
||||||
)
|
)
|
||||||
|
|
||||||
if libcalamares.utils.target_env_call(
|
if libcalamares.utils.target_env_call(
|
||||||
['getent', 'passwd', 'greeter']
|
['getent', 'passwd', self.greeter_user]
|
||||||
) != 0:
|
) != 0:
|
||||||
libcalamares.utils.target_env_call(
|
libcalamares.utils.target_env_call(
|
||||||
['useradd',
|
['useradd',
|
||||||
'-c', '"Greeter User"',
|
'-c', '"Greeter User"',
|
||||||
'-g', 'greetd',
|
'-g', self.greeter_group,
|
||||||
'-s', '/bin/bash',
|
'-s', '/bin/bash',
|
||||||
'greeter'
|
self.greeter_user
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
self.config_load()
|
|
||||||
self.config_data['terminal']['vt'] = "next"
|
|
||||||
self.config_write()
|
|
||||||
|
|
||||||
def desktop_environment_setup(self, default_desktop_environment):
|
def desktop_environment_setup(self, default_desktop_environment):
|
||||||
with open(self.environments_path(), 'w') as envs_file:
|
with open(self.environments_path(), 'w') as envs_file:
|
||||||
|
@ -892,25 +897,22 @@ class DMgreetd(DisplayManager):
|
||||||
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
||||||
self.config_load()
|
self.config_load()
|
||||||
|
|
||||||
if os.path.exists(self.os_path("usr/bin/gtkgreed") and os.path.exists(self.os_path("usr/bin/cage")):
|
if os.path.exists(self.os_path("usr/bin/gtkgreed")) and os.path.exists(self.os_path("usr/bin/cage")):
|
||||||
self.config_data['default_session']['command'] = "cage gtkgreet"
|
self.config_data['default_session']['command'] = "cage -s -- gtkgreet"
|
||||||
elif os.path.exists(self.os_path("usr/bin/tuigreet")):
|
elif os.path.exists(self.os_path("usr/bin/tuigreet")):
|
||||||
tuigreet_base_cmd = "tuigreet --remember --time --issue --asterisks --cmd "
|
tuigreet_base_cmd = "tuigreet --remember --time --issue --asterisks --cmd "
|
||||||
self.config_data['default_session']['command'] = tuigreet_base_cmd + default_desktop_environment
|
self.config_data['default_session']['command'] = tuigreet_base_cmd + default_desktop_environment
|
||||||
elif os.path.exists(self.os_path("usr/bin/ddlm")):
|
elif os.path.exists(self.os_path("usr/bin/ddlm")):
|
||||||
self.config_data['default_session']['command'] = "ddlm --target sway"
|
self.config_data['default_session']['command'] = "ddlm --target " + default_desktop_environment
|
||||||
else:
|
else:
|
||||||
self.config_data['default_session']['command'] = "agreety --cmd " + default_desktop_environment
|
self.config_data['default_session']['command'] = "agreety --cmd " + default_desktop_environment
|
||||||
|
|
||||||
if do_autologin == True:
|
if do_autologin == True:
|
||||||
self.config_data['initial_session'] = {}
|
self.config_data['initial_session'] = dict(command = default_desktop_environment, user = username)
|
||||||
self.config_data['initial_session']['command'] = default_desktop_environment
|
|
||||||
self.config_data['initial_session']['user'] = username
|
|
||||||
|
|
||||||
self.config_write()
|
self.config_write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DMsysconfig(DisplayManager):
|
class DMsysconfig(DisplayManager):
|
||||||
name = "sysconfig"
|
name = "sysconfig"
|
||||||
executable = None
|
executable = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue