~postmarketos/pmbootstrap-devel

pmbootstrap: install: throw error if boot_size is too small v1 APPLIED

Oliver Smith: 1
 install: throw error if boot_size is too small

 1 files changed, 15 insertions(+), 0 deletions(-)
#1111012 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/47511/mbox | git am -3
Learn more about email & git

[PATCH pmbootstrap] install: throw error if boot_size is too small Export this patch

Make sure the user has at least 256 MiB set as their installation size,
refuse to start the installation otherwise. The default was changed in
2021, 03e9fb05 ("pmb.config.init.boot_size: set to 256 MiB (MR 2037)").

If the user ran "pmbootstrap init" before that commit, the pmbootstrap
config will have the old default set. It is very annoying when you do an
installation with it and only realize it when you run into errors, e.g.
while upgrading. I had that when testing the upgrade to the v23.12
release and also adjusted postmarketos-release-upgrade to warn if the
boot partition is smaller than expected.
---
 pmb/install/_install.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pmb/install/_install.py b/pmb/install/_install.py
index 1adfe789..b48dc84d 100644
--- a/pmb/install/_install.py
+++ b/pmb/install/_install.py
@@ -5,6 +5,7 @@ import os
import re
import glob
import shlex
import sys

import pmb.chroot
import pmb.chroot.apk
@@ -621,6 +622,19 @@ def write_cgpt_kpart(args, layout, suffix):
        args, ["dd", f"if={filename}", f"of=/dev/installp{layout['kernel']}"])


def sanity_check_boot_size(args):
    default = pmb.config.defaults["boot_size"]
    if int(args.boot_size) >= int(default):
        return
    logging.error("ERROR: your pmbootstrap has a small boot_size of"
                  f" {args.boot_size} configured, probably because the config"
                  " has been created with an old version.")
    logging.error("This can lead to problems later on, we recommend setting it"
                  f" to {default} MiB.")
    logging.error(f"Run 'pmbootstrap config boot_size {default}' and try again.")
    sys.exit(1)


def sanity_check_disk(args):
    device = args.disk
    device_name = os.path.basename(device)
@@ -1154,6 +1168,7 @@ def create_device_rootfs(args, step, steps):

def install(args):
    # Sanity checks
    sanity_check_boot_size(args)
    if not args.android_recovery_zip and args.disk:
        sanity_check_disk(args)
        sanity_check_disk_size(args)
-- 
2.43.0
Applied, thanks!

[1/1] install: throw error if boot_size is too small
      commit: e223fd03eb408e292aa065109b705692e376a008

Best regards
pmbootstrap/patches/.build.yml: SUCCESS in 18m25s

[install: throw error if boot_size is too small][0] from [Oliver Smith][1]

[0]: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/47511
[1]: mailto:ollieparanoid@postmarketos.org

✓ #1111012 SUCCESS pmbootstrap/patches/.build.yml https://builds.sr.ht/~postmarketos/job/1111012