diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 3a21adc8..d5558613 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -53,7 +53,8 @@ config_keys = ["aports", "ui", "ui_extras", "user", - "work"] + "work", + "boot_size"] # Config file/commandline default values # $WORK gets replaced with the actual value for args.work (which may be @@ -89,6 +90,7 @@ defaults = { "ui_extras": False, "user": "user", "work": os.path.expanduser("~") + "/.local/var/pmbootstrap", + "boot_size": "128", } # diff --git a/pmb/config/init.py b/pmb/config/init.py index c4622d1f..846232bf 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -336,13 +336,21 @@ def ask_for_device(args): def ask_for_additional_options(args, cfg): # Allow to skip additional options - logging.info("Additional options: Parallel jobs: " + args.jobs + - ", ccache per arch: " + args.ccache_size) + logging.info("Additional options:" + f" boot partition size: {args.boot_size} MB," + f" parallel jobs: {args.jobs}," + f" ccache per arch: {args.ccache_size}") if not pmb.helpers.cli.confirm(args, "Change them?", default=False): return + # Boot size + logging.info("What should be the boot partition size (in MB)?") + answer = pmb.helpers.cli.ask(args, "Boot size", None, args.boot_size, + validation_regex="[1-9][0-9]*") + cfg["pmbootstrap"]["boot_size"] = answer + # Parallel job count logging.info("How many jobs should run parallel on this machine, when" " compiling?") diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 565168f8..6a4d10f4 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -49,8 +49,7 @@ def get_subpartitions_size(args): # Add some free space, see also: #336, #1671 root *= 1.20 root += 50 * 1024 * 1024 - boot *= 2 - boot += 25 * 1024 * 1024 + boot = int(args.boot_size) * 1024 * 1024 return (boot, root) diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index c3d2bef5..212cdfde 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -356,6 +356,10 @@ def arguments(): pmb.config.defaults["mirror_alpine"], metavar="URL") parser.add_argument("-j", "--jobs", help="parallel jobs when compiling") + parser.add_argument("-B", "--boot-size", + help="specify an integer with your preferred boot" + "partition size on target machine in MB (default" + " 128)") parser.add_argument("-p", "--aports", help="postmarketos aports (pmaports) path") parser.add_argument("-t", "--timeout", help="seconds after which processes" diff --git a/test/test_questions.py b/test/test_questions.py index a0998631..bc7e9696 100644 --- a/test/test_questions.py +++ b/test/test_questions.py @@ -260,9 +260,10 @@ def test_questions_additional_options(args, monkeypatch): assert cfg == {"pmbootstrap": {}} # Answer everything - fake_answers(monkeypatch, ["y", "5", "2G", "n"]) + fake_answers(monkeypatch, ["y", "64", "5", "2G", "n"]) func(args, cfg) - assert cfg == {"pmbootstrap": {"jobs": "5", + assert cfg == {"pmbootstrap": {"boot_size": "64", + "jobs": "5", "ccache_size": "2G"}}