init: ask whether to install systemd (MR 2273)

Add the following question to "pmbootstrap init":

[22:12:57] Based on your UI selection, 'default' will result in installing systemd.
[22:12:57] Install systemd? (default/always/never) [default]:

Determine whether the UI prefers to have systemd or not, based on
"pmb:systemd" in the UI package's APKBUILD.

Determine whether the currently selected branch supports systemd, by
checking for a "[repo:systemd]" section in pmaports.cfg. This section
will also contain bootstrap information, to be used in future patches.
This commit is contained in:
Oliver Smith 2024-02-23 01:20:23 +01:00
parent c6e8a89ea3
commit e96ca36376
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 59 additions and 1 deletions

View file

@ -189,6 +189,24 @@ def ask_for_ui_extras(args, ui):
default=args.ui_extras)
def ask_for_systemd(args, ui):
if "systemd" not in pmb.config.pmaports.read_config_repos(args):
return args.systemd
default_is_systemd = pmb.helpers.ui.check_option(args, ui, "pmb:systemd")
not_str = " " if default_is_systemd else " not "
logging.info("Based on your UI selection, 'default' will result"
f" in{not_str}installing systemd.")
choices = ["default", "always", "never"]
answer = pmb.helpers.cli.ask("Install systemd?",
choices,
args.systemd,
validation_regex=f"^({'|'.join(choices)})$",
complete=choices)
return answer
def ask_for_keymaps(args, info):
if "keymaps" not in info or info["keymaps"].strip() == "":
return ""
@ -673,6 +691,10 @@ def frontend(args):
ui = ask_for_ui(args, info)
cfg["pmbootstrap"]["ui"] = ui
cfg["pmbootstrap"]["ui_extras"] = str(ask_for_ui_extras(args, ui))
# systemd
cfg["pmbootstrap"]["systemd"] = ask_for_systemd(args, ui)
ask_for_provider_select_pkg(args, f"postmarketos-ui-{ui}",
cfg["providers"])
ask_for_additional_options(args, cfg)