make boot partition size user-overridable (MR 1931)
Ask for the boot partition size during "pmbootstrap init" in the additional options with a default of 128 MB, and allow to override it with -B.
This commit is contained in:
parent
d623913491
commit
37b4af19fc
|
@ -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",
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -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?")
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"}}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue