forked from Mirror/pmbootstrap
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
5 changed files with 21 additions and 7 deletions
|
@ -53,7 +53,8 @@ config_keys = ["aports",
|
||||||
"ui",
|
"ui",
|
||||||
"ui_extras",
|
"ui_extras",
|
||||||
"user",
|
"user",
|
||||||
"work"]
|
"work",
|
||||||
|
"boot_size"]
|
||||||
|
|
||||||
# Config file/commandline default values
|
# Config file/commandline default values
|
||||||
# $WORK gets replaced with the actual value for args.work (which may be
|
# $WORK gets replaced with the actual value for args.work (which may be
|
||||||
|
@ -89,6 +90,7 @@ defaults = {
|
||||||
"ui_extras": False,
|
"ui_extras": False,
|
||||||
"user": "user",
|
"user": "user",
|
||||||
"work": os.path.expanduser("~") + "/.local/var/pmbootstrap",
|
"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):
|
def ask_for_additional_options(args, cfg):
|
||||||
# Allow to skip additional options
|
# Allow to skip additional options
|
||||||
logging.info("Additional options: Parallel jobs: " + args.jobs +
|
logging.info("Additional options:"
|
||||||
", ccache per arch: " + args.ccache_size)
|
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?",
|
if not pmb.helpers.cli.confirm(args, "Change them?",
|
||||||
default=False):
|
default=False):
|
||||||
return
|
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
|
# Parallel job count
|
||||||
logging.info("How many jobs should run parallel on this machine, when"
|
logging.info("How many jobs should run parallel on this machine, when"
|
||||||
" compiling?")
|
" compiling?")
|
||||||
|
|
|
@ -49,8 +49,7 @@ def get_subpartitions_size(args):
|
||||||
# Add some free space, see also: #336, #1671
|
# Add some free space, see also: #336, #1671
|
||||||
root *= 1.20
|
root *= 1.20
|
||||||
root += 50 * 1024 * 1024
|
root += 50 * 1024 * 1024
|
||||||
boot *= 2
|
boot = int(args.boot_size) * 1024 * 1024
|
||||||
boot += 25 * 1024 * 1024
|
|
||||||
return (boot, root)
|
return (boot, root)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,10 @@ def arguments():
|
||||||
pmb.config.defaults["mirror_alpine"],
|
pmb.config.defaults["mirror_alpine"],
|
||||||
metavar="URL")
|
metavar="URL")
|
||||||
parser.add_argument("-j", "--jobs", help="parallel jobs when compiling")
|
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",
|
parser.add_argument("-p", "--aports",
|
||||||
help="postmarketos aports (pmaports) path")
|
help="postmarketos aports (pmaports) path")
|
||||||
parser.add_argument("-t", "--timeout", help="seconds after which processes"
|
parser.add_argument("-t", "--timeout", help="seconds after which processes"
|
||||||
|
|
|
@ -260,9 +260,10 @@ def test_questions_additional_options(args, monkeypatch):
|
||||||
assert cfg == {"pmbootstrap": {}}
|
assert cfg == {"pmbootstrap": {}}
|
||||||
|
|
||||||
# Answer everything
|
# Answer everything
|
||||||
fake_answers(monkeypatch, ["y", "5", "2G", "n"])
|
fake_answers(monkeypatch, ["y", "64", "5", "2G", "n"])
|
||||||
func(args, cfg)
|
func(args, cfg)
|
||||||
assert cfg == {"pmbootstrap": {"jobs": "5",
|
assert cfg == {"pmbootstrap": {"boot_size": "64",
|
||||||
|
"jobs": "5",
|
||||||
"ccache_size": "2G"}}
|
"ccache_size": "2G"}}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue