stages/sysconfig: add desktop support
This commit is contained in:
parent
829183a1f3
commit
36ee0d3edc
1 changed files with 35 additions and 0 deletions
|
|
@ -164,6 +164,24 @@ SCHEMA = r"""
|
|||
"description": "Livesys session to use"
|
||||
}
|
||||
}
|
||||
},
|
||||
"desktop": {
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"anyOf": [
|
||||
{"required": ["preferred"]},
|
||||
{"required": ["displaymanager"]}
|
||||
],
|
||||
"properties": {
|
||||
"preferred": {
|
||||
"type": "string",
|
||||
"description": "Preferred desktop to use."
|
||||
},
|
||||
"displaymanager": {
|
||||
"type": "string",
|
||||
"description": "Displaymanager to use."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
|
@ -185,6 +203,21 @@ def configure_livesys(tree, livesys_options):
|
|||
os.fchmod(livesys_file.fileno(), 0o644)
|
||||
|
||||
|
||||
def configure_desktop(tree, desktop_options):
|
||||
if not desktop_options:
|
||||
return
|
||||
|
||||
with open(f"{tree}/etc/sysconfig/desktop", "w", encoding="utf8") as desktop_file:
|
||||
if "preferred" in desktop_options:
|
||||
desktop_file.write("PREFERRED={desktop_options['preferred']}\n")
|
||||
|
||||
if "displaymanager" in desktop_options:
|
||||
desktop_file.write("DISPLAYMANAGER={desktop_options['displaymanager']}\n")
|
||||
|
||||
os.fchown(desktop_file.fileno(), 0, 0)
|
||||
os.fchmod(desktop_file.fileno(), 0o644)
|
||||
|
||||
|
||||
def configure_kernel(tree, kernel_options):
|
||||
if not kernel_options:
|
||||
return
|
||||
|
|
@ -263,11 +296,13 @@ def main(tree, options):
|
|||
network_options = options.get("network", {})
|
||||
network_scripts_options = options.get("network-scripts", {})
|
||||
livesys_options = options.get("livesys", {})
|
||||
desktop_options = options.get("desktop", {})
|
||||
|
||||
configure_kernel(tree, kernel_options)
|
||||
configure_network(tree, network_options)
|
||||
configure_network_scripts(tree, network_scripts_options)
|
||||
configure_livesys(tree, livesys_options)
|
||||
configure_desktop(tree, desktop_options)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue