pmb.config.init: prompt for installing UI extras package (!1906)

This commit is contained in:
Daniele Debernardi 2020-04-05 04:27:13 +02:00 committed by Oliver Smith
parent 8dc8daa05a
commit 43bf45bd02
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 23 additions and 2 deletions

View File

@ -39,7 +39,8 @@ required_programs = ["git", "openssl", "ps"]
# Keys saved in the config file (mostly what we ask in 'pmbootstrap init')
config_keys = ["ccache_size", "device", "extra_packages", "hostname", "jobs",
"kernel", "keymap", "nonfree_firmware", "nonfree_userland",
"ssh_keys", "timezone", "ui", "user", "work", "aports"]
"ssh_keys", "timezone", "ui", "ui_extras", "user", "work",
"aports"]
# Config file/commandline default values
# $WORK gets replaced with the actual value for args.work (which may be
@ -72,6 +73,7 @@ defaults = {
"ssh_keys": False,
"timezone": "GMT",
"ui": "weston",
"ui_extras": False,
"user": "user",
"work": os.path.expanduser("~") + "/.local/var/pmbootstrap",
}

View File

@ -89,6 +89,21 @@ def ask_for_ui(args):
" one from the list above.")
def ask_for_ui_extras(args, ui):
apkbuild = pmb.helpers.pmaports.get(args, "postmarketos-ui-" + ui)
if not apkbuild:
return False
extra = apkbuild["subpackages"].get("postmarketos-ui-" + ui + "-extras")
if extra is None:
return False
logging.info("This user interface has an extra package: " + extra["pkgdesc"])
return pmb.helpers.cli.confirm(args, "Enable this package?",
default=args.ui_extras)
def ask_for_keymaps(args, device):
info = pmb.parse.deviceinfo(args, device)
if "keymaps" not in info or info["keymaps"].strip() == "":
@ -365,7 +380,9 @@ def frontend(args):
args.user, False,
"[a-z_][a-z0-9_-]*")
# UI and various build options
cfg["pmbootstrap"]["ui"] = ask_for_ui(args)
ui = ask_for_ui(args)
cfg["pmbootstrap"]["ui"] = ui
cfg["pmbootstrap"]["ui_extras"] = str(ask_for_ui_extras(args, ui))
ask_for_build_options(args, cfg)
# Extra packages to be installed to rootfs

View File

@ -508,6 +508,8 @@ def install(args):
install_packages = [p for p in install_packages if p != "postmarketos-base"]
if args.ui.lower() != "none":
install_packages += ["postmarketos-ui-" + args.ui]
if args.ui_extras:
install_packages += ["postmarketos-ui-" + args.ui + "-extras"]
suffix = "rootfs_" + args.device
pmb.chroot.apk.upgrade(args, suffix)